/**
 * Превью сторис: все дочерние узлы видны, но нажатия получает только корень карточки —
 * так мобильные браузеры не отдают касание элементу video/img/градиентному оверлею.
 */
[data-story-modal-open] {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto !important;
}

/* Кнопка-карточка вместо <a href="#"> — без прыжка на # в урле и прокрутки вверх */
button[data-story-modal-open],
a[data-story-modal-open] {
  font: inherit;
  color: inherit;
  text-decoration: none;
}

button[data-story-modal-open] {
  display: block;
  padding: 0;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

[data-story-modal-open] * {
  pointer-events: none !important;
}

.story-item[data-story-id] .story-delete-btn,
.story-item[data-story-id] [data-story-delete],
.stories-section .story-item[data-story-id] .story-delete-btn,
.stories-section .story-item[data-story-id] [data-story-delete],
button.story-delete-btn[data-story-delete],
button[data-story-delete][data-delete-url] {
  pointer-events: auto !important;
  position: absolute !important;
  top: var(--story-delete-inset, 4px) !important;
  right: var(--story-delete-inset, 4px) !important;
  left: auto !important;
  bottom: auto !important;
  z-index: 12;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #0f172a !important;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  text-decoration: none !important;
  text-shadow:
    0 0 2px rgba(255, 255, 255, 0.95),
    0 1px 2px rgba(255, 255, 255, 0.85);
}

.story-item[data-story-id] .story-delete-btn:hover,
.story-item[data-story-id] [data-story-delete]:hover,
.stories-section .story-item[data-story-id] .story-delete-btn:hover,
.stories-section .story-item[data-story-id] [data-story-delete]:hover,
button.story-delete-btn[data-story-delete]:hover,
button[data-story-delete][data-delete-url]:hover {
  background: transparent !important;
  color: #000 !important;
  opacity: 0.85;
}

/* То же правило классики главной страницы, если здесь когда-нибудь появится .story-item */
.story-item[data-story-id] [data-story-open],
.story-item[data-story-id] .story-preview-hit {
  pointer-events: auto !important;
}

.story-item[data-story-id] [data-story-open] *,
.story-item[data-story-id] .story-preview-hit * {
  pointer-events: none !important;
}

.story-item[data-story-id] {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto !important;
}

.story-item[data-story-id] * {
  pointer-events: none !important;
}

.story-item[data-story-id] > .profile-moments-add-btn,
.story-item[data-story-id] > .profile-moments-add-btn--on-story,
.stories-section .story-item[data-story-id] > .profile-moments-add-btn,
.stories-section .story-item[data-story-id] > .profile-moments-add-btn--on-story {
  pointer-events: auto !important;
  position: absolute;
  z-index: 15;
}

.story-title {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.tb-story-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.stories-grid,
.tb-stories-track,
.group-stories-track,
[data-stories-track] {
  align-items: stretch;
}

.story-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  z-index: 14000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.story-modal-content {
  width: min(92vw, 420px);
}

.story-viewer {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  --story-progress-top: 8px;
  --story-progress-track-height: 20px;
  --story-avatar-below-progress-gap: 8px;
  --story-nav-avatar-size: 56px;
  --story-viewer-header-top: calc(
    var(--story-progress-top) + var(--story-progress-track-height) +
      var(--story-avatar-below-progress-gap)
  );
}

.story-viewer-avatars {
  position: absolute;
  top: var(--story-viewer-header-top);
  left: 10px;
  z-index: 20;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.story-nav-avatar {
  width: var(--story-nav-avatar-size);
  height: var(--story-nav-avatar-size);
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  background: #475569;
  text-decoration: none;
  pointer-events: auto;
}

.story-nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-nav-avatar--empty {
  background: linear-gradient(135deg, #64748b, #334155);
}

.story-nav-avatar--empty img {
  display: none;
}

.story-media-container {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #020617;
  display: block;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  touch-action: pan-y pinch-zoom;
  z-index: 6;
}

.story-media-inner {
  position: absolute;
  inset: 0;
  z-index: 1;
  will-change: transform;
}

.story-slide-snapshot {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-color: #020617;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.story-media-container > video,
.story-media-container > img,
.story-media-container > #story-video,
.story-media-container > #story-image,
.story-media-inner > video,
.story-media-inner > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-media-container video,
.story-media-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-media-container img.story-crop-active {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: none;
  position: absolute;
  left: 50%;
  top: 50%;
}

.story-media-container.story-crop-frame {
  display: block;
}

.story-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "chips center heart";
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  opacity: 1;
  pointer-events: auto;
  z-index: 12;
  box-sizing: border-box;
  color: #fff;
}

.home-story-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "chips center heart";
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  z-index: 12;
  pointer-events: auto;
  box-sizing: border-box;
  color: #fff;
}

.home-story-controls__center {
  grid-area: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  justify-self: center;
}

.story-container:hover .story-controls {
  opacity: 1;
  pointer-events: auto;
}

.story-control-btn {
  border: 0;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  overflow: visible;
}

.story-control-btn--comments {
  width: auto;
  min-width: 34px;
  padding: 0 9px;
  border-radius: 999px;
}

.story-control-icon {
  width: 18px;
  height: 18px;
  display: block;
  flex-shrink: 0;
}

.story-menu-wrap { position: relative; }
.story-menu {
  position: absolute;
  right: 0;
  bottom: 42px;
  min-width: 170px;
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  overflow: hidden;
}
.story-menu button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}
.story-menu button:hover { background: rgba(148, 163, 184, 0.2); }

.story-move-panel {
  position: absolute;
  right: 0;
  bottom: 42px;
  width: 220px;
  background: rgba(2, 6, 23, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 10px;
}
.story-move-title {
  color: #fff;
  font-size: 12px;
  margin-bottom: 8px;
}
.story-move-select {
  width: 100%;
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}
.story-move-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.story-move-actions button {
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
#storyMoveCancelBtn {
  background: rgba(148, 163, 184, 0.2);
  color: #fff;
}
#storyMoveConfirmBtn {
  background: #2563eb;
  color: #fff;
}

.story-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px;
  padding-bottom: 64px;
  background: linear-gradient(180deg, transparent, rgba(2, 6, 23, 0.78));
  color: #fff;
  /* Выше .story-media-container (z-index: 6), иначе подпись под видео не видна на мобильном */
  z-index: 13;
  pointer-events: none;
}

.story-caption h4,
.story-caption h4 a.miravi-hashtag-link,
.story-caption h4 a.story-hashtag-link {
  pointer-events: auto;
}

.story-caption h4 a.miravi-hashtag-link,
.story-caption h4 a.story-hashtag-link {
  color: inherit;
  text-decoration: underline;
  font-weight: 900;
}

.story-caption h4 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 900;
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.story-reactions-wrap {
  display: contents;
}

.story-reactions-wrap[hidden] {
  display: none !important;
}

.home-story-controls .story-reactions-chips,
.story-controls .story-reactions-chips {
  grid-area: chips;
  order: unset;
  justify-self: start;
  align-self: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
  align-items: center;
  flex: unset;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  pointer-events: auto;
}

.home-story-controls .story-reactions-chips[hidden],
.story-controls .story-reactions-chips[hidden] {
  visibility: hidden;
  display: flex !important;
  pointer-events: none;
}

.story-reactions-anchor {
  grid-area: heart;
  position: relative;
  flex: 0 0 auto;
  order: unset;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  pointer-events: auto;
  z-index: 13;
}

.story-reactions-anchor[hidden] {
  visibility: hidden;
  display: flex !important;
  pointer-events: none;
}

.story-reactions-heart {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.65);
  color: rgba(255, 255, 255, 0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 14;
  pointer-events: auto;
}

.story-reactions-heart:hover,
.story-reactions-heart:focus-visible {
  color: #fff;
  outline: none;
}

.story-reactions-heart--active {
  color: #fff;
}

.story-reactions-heart__icon {
  width: 24px;
  height: 24px;
  display: block;
}

.story-reactions-heart__emoji {
  font-size: 22px;
  line-height: 1;
  display: block;
}

.story-reactions-popover {
  position: fixed;
  z-index: 20000;
  padding: 6px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.story-reactions-popover[hidden] {
  display: none !important;
}

.story-reactions-panel,
.story-reactions-panel--picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  width: min(292px, calc(100vw - 24px));
}

.story-reaction-emoji-row {
  display: grid;
  grid-template-columns: repeat(4, 34px);
  gap: 4px;
  width: calc(4 * 34px + 3 * 4px);
}

.story-reaction-kolobki {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 6px;
}

.story-reaction-kolobki .kolobki-section-title,
.story-reaction-kolobki .section-title {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.story-reaction-kolobki-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 168px;
  overflow: auto;
  padding-right: 2px;
}

.story-reaction-btn {
  position: relative;
  border: 0;
  background: transparent;
  border-radius: 6px;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.story-reaction-btn img,
.story-reaction-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.story-reactions-heart__emoji img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.story-reaction-chip {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  text-shadow: none;
}

.story-reaction-chip:hover,
.story-reaction-chip:focus-visible {
  outline: none;
  color: #fff;
}

.story-reaction-chip__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex: 0 0 auto;
}

.story-reaction-chip__img,
.story-reaction-chip__icon img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}

.story-reaction-chip__emoji {
  font-size: 28px;
  line-height: 1;
  display: block;
}

.story-reaction-chip__count {
  font-size: 0.5em;
  font-weight: 800;
  line-height: 1;
  color: rgba(255, 255, 255, 0.72);
  padding-bottom: 1px;
}

.story-reaction-chip--empty {
  color: rgba(255, 255, 255, 0.78);
}

.story-reaction-chip--empty .story-reactions-heart__icon {
  width: 26px;
  height: 26px;
  display: block;
}

.story-reaction-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.story-reaction-btn--mine {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.story-reaction-btn__count {
  display: none;
}

.story-reactions-chips {
  order: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - 52px);
  min-height: 0;
}

.story-reaction-chip--mine {
  background: transparent;
  box-shadow: none;
  opacity: 1;
}

.story-reaction-chip--mine .story-reaction-chip__count {
  color: #fff;
}

.story-reactions-guest-hint {
  position: fixed;
  z-index: 10051;
  margin: 0;
  max-width: 220px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  text-align: center;
  font-size: 12px;
  line-height: 1.3;
  opacity: 1;
  pointer-events: none;
}

.story-modal--hide-caption .story-caption--no-title {
  padding-top: 0;
}

.story-modal--hide-caption .story-caption--no-title h4 {
  display: none !important;
}

.story-comments-toggle__count {
  display: inline-block;
  min-width: 14px;
  margin-left: 0;
  padding: 0 3px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.9);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  vertical-align: middle;
  flex-shrink: 0;
}

.story-comments-drawer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  max-height: 58%;
  display: flex;
  flex-direction: column;
  background: rgba(2, 6, 23, 0.96);
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  pointer-events: auto;
  transition: transform 0.14s ease-out, max-height 0.14s ease-out;
  will-change: transform;
}

.story-comments-drawer--kb {
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.story-comments-drawer[hidden] {
  display: none !important;
}

.story-comments-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}

.story-comments-close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.story-comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  min-height: 80px;
}

.story-comments-empty {
  margin: 0;
  font-size: 13px;
  opacity: 0.75;
  color: #fff;
}

.story-comment {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.story-comment__avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.story-comment__avatar--empty {
  background: rgba(148, 163, 184, 0.35);
}

.story-comment__body {
  flex: 1;
  min-width: 0;
}

.story-comment__meta {
  font-size: 12px;
  color: rgba(226, 232, 240, 0.85);
  margin-bottom: 2px;
}

.story-comment__author {
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.story-comment__text {
  font-size: 14px;
  line-height: 1.35;
  color: #fff;
  word-break: break-word;
}

.story-comment__reply-btn {
  margin-top: 4px;
  border: 0;
  background: transparent;
  color: rgba(191, 219, 254, 0.95);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.story-comments-compose {
  padding: 8px 12px 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.story-comments-compose[hidden] {
  display: none !important;
}

.story-comments-reply-hint {
  margin: 0 0 6px;
  font-size: 12px;
  color: rgba(191, 219, 254, 0.95);
}

.story-comments-reply-cancel {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
}

.story-comments-compose-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.story-comments-compose textarea {
  flex: 1;
  min-height: 40px;
  max-height: 96px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
}

.story-comments-send {
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  padding: 10px 12px;
  cursor: pointer;
}

.story-comments-send:disabled {
  opacity: 0.6;
  cursor: default;
}

.story-comments-guest-hint {
  margin: 0;
  padding: 8px 12px 12px;
  font-size: 12px;
  opacity: 0.85;
  color: #fff;
}

.story-preview--processing {
  background: #1e293b !important;
}

.story-preview-processing-label {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  text-align: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  background: rgba(15, 23, 42, 0.78);
  pointer-events: none;
}

.story-preview-processing-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: story-processing-spin 0.8s linear infinite;
}

.story-preview-processing-text {
  font-size: 12px;
  font-weight: 800;
}

.story-preview-processing-hint {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.85;
}

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

.story-item[data-video-processing="1"] .story-preview-hit,
.story-item--uploading,
.story-item--processing-wait {
  cursor: wait;
}

.story-item--uploading .story-preview,
.story-item--processing-wait .story-preview {
  background: #1e293b;
}

.story-item--uploading .story-upload-status,
.story-item--processing-wait .story-upload-status {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px;
  text-align: center;
  color: #fff;
  background: rgba(15, 23, 42, 0.78);
  pointer-events: none;
}

.story-item--uploading .story-upload-status-title,
.story-item--processing-wait .story-upload-status-title {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.story-item--uploading .story-upload-status-hint,
.story-item--processing-wait .story-upload-status-hint {
  font-size: 10px;
  font-weight: 600;
  opacity: 0.85;
  line-height: 1.3;
}

.story-progress {
  position: absolute;
  top: var(--story-progress-top, 8px);
  left: 10px;
  right: 10px;
  z-index: 14;
  min-height: var(--story-progress-track-height, 20px);
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
}

.story-progress-bar {
  width: 0%;
  height: 4px;
  align-self: center;
  border-radius: 999px;
  background: #fff;
  transition: width 0.08s linear;
}

.story-close,
.story-prev,
.story-next {
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 24px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

.story-prev,
.story-next {
  position: absolute;
  z-index: 25;
  pointer-events: auto;
  width: 44px;
  height: 44px;
  font-size: 28px;
}

.story-viewer-top-actions {
  position: absolute;
  top: var(--story-viewer-header-top);
  right: 10px;
  z-index: 21;
  height: var(--story-nav-avatar-size);
  display: flex;
  align-items: center;
  gap: 8px;
}

.story-viewer-pin-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(100, 116, 139, 0.92);
  color: #f8fafc;
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, width 0.15s ease, border-radius 0.15s ease;
}

.story-viewer-pin-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.story-viewer-pin-btn__check {
  display: none;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.story-viewer-pin-btn.is-pinned {
  width: auto;
  min-width: 36px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border-color: rgba(255, 255, 255, 0.55);
  background: #22c55e;
  color: #fff;
}

.story-viewer-pin-btn.is-pinned .story-viewer-pin-btn__check {
  display: inline-flex;
}

.story-viewer-top-actions .story-close {
  position: relative;
  flex-shrink: 0;
}

.story-prev { top: 50%; left: 8px; transform: translateY(-50%); }
.story-next { top: 50%; right: 8px; transform: translateY(-50%); }

@media (max-width: 720px) {
  .story-modal .story-prev,
  .story-modal .story-next {
    display: none !important;
  }

  .story-modal .story-viewer {
    touch-action: pan-y pinch-zoom;
  }

  .story-caption {
    z-index: 13;
    padding-bottom: max(72px, calc(56px + env(safe-area-inset-bottom, 0px)));
  }

  .story-caption h4 {
    font-size: 15px;
    line-height: 1.35;
    max-height: 30vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

