/* ===== PULSE Stories — Telegram style ===== */
.stories-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 8px 8px;
  margin: 0 0 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: #fff;
  border-radius: 0;
  border: none;
  box-shadow: none;
}
[data-theme="dark"] .stories-strip {
  background: var(--bg-card, #111);
}
.stories-strip::-webkit-scrollbar { display: none; }

.st-item {
  flex: 0 0 auto;
  width: 72px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.st-ring {
  width: 64px;
  height: 64px;
  margin: 0 auto 4px;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  position: relative;
  box-sizing: border-box;
}
.st-seg {
  position: absolute;
  inset: 0;
  width: 64px;
  height: 64px;
  pointer-events: none;
  z-index: 1;
}
.st-avatar {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2.5px solid var(--bg-card, #fff);
  background: #ddd;
  box-sizing: border-box;
  z-index: 2;
}
.st-add {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  border: 2px solid var(--bg-card, #fff);
  z-index: 5;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.stories-strip .st-name, .st-item .st-name {
  font-size: 11px;
  color: var(--text, #222);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
  margin: 0 auto;
  line-height: 1.2;
}
.st-item.unviewed .st-name { font-weight: 600; }

/* ===== Viewer (fullscreen) ===== */
.st-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 100000;
  background: #000;
  display: none;
  flex-direction: column;
  color: #fff;
  touch-action: none;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.st-viewer.open {
  display: flex;
  touch-action: none;
  pointer-events: auto;
}
.st-viewer * { box-sizing: border-box; }

.st-progress {
  /* status-bar (soat/antenna) ostidan boshlansin */
  display: flex;
  gap: 3px;
  padding: calc(14px + max(env(safe-area-inset-top, 0px), 18px)) 10px 0;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 5;
}
.st-progress-seg {
  flex: 1;
  height: 2.5px;
  background: rgba(255,255,255,.35);
  border-radius: 2px;
  overflow: hidden;
}
.st-progress-seg > i {
  display: block;
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
}
.st-progress-seg.done > i { width: 100% !important; }
.st-progress-seg.active > i { transition: width linear; }

.st-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px;
  margin-top: calc(22px + max(env(safe-area-inset-top, 0px), 18px));
  position: relative;
  z-index: 6;
}
.st-head-av {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,.5);
}
.st-head-meta { flex: 1; min-width: 0; }
.st-head-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.st-head-time { font-size: 12px; opacity: .75; }
.st-head-btn {
  background: none;
  border: none;
  color: #fff;
  width: 36px; height: 36px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .95;
}

.st-media-wrap {
  position: absolute;
  left: 0; right: 0;
  top: 0; bottom: 0;
  overflow: hidden;
  background: #000;
  z-index: 1;
}
.st-media-wrap img,
.st-media-wrap video {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}
.st-tap-zones {
  position: absolute;
  inset: 0;
  display: flex;
  z-index: 3;
}
.st-tap-left, .st-tap-right {
  flex: 1;
  height: 100%;
}
.st-caption {
  position: absolute;
  left: 0; right: 0; bottom: 72px;
  padding: 12px 16px;
  text-align: center;
  font-size: 15px;
  line-height: 1.35;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  z-index: 4;
  pointer-events: none;
}

.st-footer {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(transparent, rgba(0,0,0,.55));
}
.st-footer .st-react-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding: 6px 8px 8px;
  margin: 0 4px 0 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: rgba(28,28,30,.72);
  border-radius: 28px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.st-react-row::-webkit-scrollbar { display: none; }
.st-react-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease;
}
.st-react-btn:active { transform: scale(1.2); }
.st-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}
.st-views,
.st-reacts-btn {
  background: rgba(0,0,0,.4);
  border: none;
  color: #fff;
  border-radius: 22px;
  padding: 7px 12px;
  min-width: 52px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1;
}
.st-reacts-btn {
  /* same as views */
}
.st-views:active, .st-reacts-btn:active { background: rgba(255,255,255,.22); }

/* Bottom sheet — viewers / reactions (Telegram-like) */
.st-sheet {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.st-sheet-box {
  width: 100%;
  max-width: 480px;
  max-height: 55vh;
  background: #1c1c1e;
  color: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  animation: stSlideUp .2s ease;
}
.st-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
  font-weight: 700;
  font-size: 16px;
}
.st-sheet-head button {
  background: none; border: none; color: #aaa; font-size: 18px; cursor: pointer;
}
.st-sheet-tabs {
  display: flex;
  gap: 6px;
  padding: 0 12px 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.st-sheet-tabs::-webkit-scrollbar { display: none; }
.st-sheet-tab {
  flex-shrink: 0;
  border: none;
  background: rgba(255,255,255,.1);
  color: #fff;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.st-sheet-tab.active { background: rgba(0,180,228,.35); }
.st-sheet-list {
  overflow-y: auto;
  padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}
.st-sheet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  color: #fff;
}
.st-sheet-row:active { background: rgba(255,255,255,.06); }
.st-sheet-row img {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.st-sheet-meta { flex: 1; min-width: 0; }
.st-sheet-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-sheet-sub { font-size: 13px; color: #8e8e93; }
.st-sheet-emoji { font-size: 22px; flex-shrink: 0; }
.st-sheet-empty {
  text-align: center;
  padding: 28px 16px;
  color: #8e8e93;
  font-size: 14px;
}

/* Reaction picker — yashirin, layk bosilganda ochiladi */
.st-footer .st-react-row,
.st-react-row {
  display: none;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding: 6px 10px;
  margin: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: rgba(28,28,30,.78);
  border-radius: 28px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(10px) scale(.96);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.st-react-row::-webkit-scrollbar { display: none; }
.st-react-row.open {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.st-react-row.st-react-hide {
  opacity: 0;
  transform: translateY(8px) scale(.96);
  pointer-events: none;
}
.st-react-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}
.st-reacts-btn {
  border: none;
  background: rgba(255,255,255,.12);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}


.st-footer .st-heart-side {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}


/* Floating reaction burst */
.st-react-float {
  position: absolute;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  font-size: 64px;
  z-index: 30;
  pointer-events: none;
  animation: stFloatReact 1.1s ease forwards;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.45));
}
@keyframes stFloatReact {
  0% { opacity: 0; transform: translateX(-50%) translateY(24px) scale(.4); }
  25% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.15); }
  70% { opacity: 1; transform: translateX(-50%) translateY(-40px) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-90px) scale(.85); }
}

/* No ring/border when user has zero stories (own empty) */
.st-item.own:not(.has-story) .st-ring::before,
.st-item.own:not(.has-story) .st-seg { display: none !important; }
.st-item.own:not(.has-story) .st-avatar {
  border-color: var(--bg-card, #fff);
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
}

.st-full {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

.st-reacts-btn.is-on,
.st-reacts-btn.is-on i {
  color: #ff3b5c !important;
}
.st-reacts-btn.is-on {
  background: rgba(255,59,92,.25);
}
.st-reacts-btn.is-on i.fa-heart {
  color: #ff3b5c !important;
}


/* ===== Create story modal ===== */
.st-create {
  position: fixed;
  inset: 0;
  z-index: 100050;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  -webkit-user-select: auto;
  user-select: auto;
}
.st-create.open {
  display: flex;
}
.st-create-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-card, #fff);
  color: var(--text, #111);
  border-radius: 18px 18px 0 0;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -8px 40px rgba(0,0,0,.25);
}
.st-create-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 17px;
  margin-bottom: 12px;
}
.st-create-title button {
  border: none;
  background: rgba(0,0,0,.06);
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: var(--text, #333);
}
.st-preview {
  display: none;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  margin-bottom: 12px;
  max-height: 280px;
}
.st-preview.show { display: block; }
.st-preview img,
.st-preview video {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}
.st-create-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.st-pick-btn {
  flex: 1;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--bg, #f8fafc);
  color: var(--text, #111);
  border-radius: 12px;
  padding: 12px 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.st-pick-btn:active { transform: scale(.98); }
.st-caption-input {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  resize: vertical;
  margin-bottom: 12px;
  background: var(--bg, #fff);
  color: var(--text, #111);
  box-sizing: border-box;
}
.st-publish {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  background: linear-gradient(135deg, #00d4ff, #2563eb);
  color: #fff;
}
.st-publish:disabled {
  opacity: .45;
  cursor: not-allowed;
}
[data-theme="dark"] .st-create-sheet {
  background: #1c1c1e;
  color: #fff;
}
[data-theme="dark"] .st-pick-btn {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #fff;
}
[data-theme="dark"] .st-caption-input {
  background: #2c2c2e;
  border-color: #3a3a3c;
  color: #fff;
}


/* Video trim (max 60s) */
.st-trim {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #111;
  border-radius: 14px;
  color: #fff;
}
.st-trim-label {
  font-size: 12px;
  font-weight: 600;
  opacity: .9;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.st-trim-label span { opacity: .75; font-variant-numeric: tabular-nums; }
.st-trim-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.st-trim-play {
  width: 36px; height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.st-trim-range {
  flex: 1;
  accent-color: #3b82f6;
}
.st-trim-bar {
  position: relative;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(90deg, #333 0%, #555 50%, #333 100%);
  overflow: hidden;
}
.st-trim-window {
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 40%;
  border: 2px solid #facc15;
  border-radius: 8px;
  background: rgba(250, 204, 21, .15);
  box-sizing: border-box;
  pointer-events: none;
}
