.profile-story-ring {
  cursor: default;
}

.profile-story-ring.has-story {
  cursor: pointer;
}

.profile-story-ring.has-story::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: linear-gradient(45deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
  background-size: 300% 300%;
  animation: profileStoryRingShimmer 4s ease infinite;
  z-index: 0;
}

.profile-story-ring .store-logo {
  z-index: 1;
}

/* Shrink the avatar photo slightly inward so the gradient ring reads as a
   border sitting inside the original avatar footprint, not a halo bleeding
   past it — this keeps the ring's outer edge exactly matching the profile
   picture's own circle. */
.profile-story-ring.has-story .store-logo {
  inset: 3px;
  box-shadow: none;
}

.profile-story-ring.has-story.story-seen::before {
  background: linear-gradient(45deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
  background-size: 300% 300%;
  animation: none;
}

.profile-story-ring.has-story:active {
  transform: scale(0.97);
}

@keyframes profileStoryRingShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#storyViewerOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: none;
  align-items: stretch;
  justify-content: center;
  overscroll-behavior: contain;
}
#storyViewerOverlay.open { display: flex; }

.story-viewer-inner {
  position: relative;
  width: 100%;
  max-width: 460px;
  height: 100%;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.story-viewer-progress-row {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 4px;
  padding: 10px 8px 0;
  z-index: 3;
}

.story-viewer-progress-bar {
  flex: 1;
  height: 2.5px;
  border-radius: 2px;
  background: rgba(255,255,255,0.3);
  overflow: hidden;
}

.story-viewer-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
}

.story-viewer-header {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}

.story-viewer-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.5);
}

.story-viewer-store-name {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.story-viewer-time {
  color: rgba(255,255,255,0.75);
  font-size: 11.5px;
  margin-top: 1px;
}

.story-viewer-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.story-viewer-media-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.story-media {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  will-change: transform;
}

.story-viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 28px;
  z-index: 2;
}
.story-viewer-loading i { animation: storyViewerSpin 0.8s linear infinite; }
@keyframes storyViewerSpin { to { transform: rotate(360deg); } }

.story-viewer-tap-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 32%;
  z-index: 2;
  background: transparent;
  border: none;
}
.story-viewer-tap-zone.left { left: 0; }
.story-viewer-tap-zone.right { right: 0; }

.story-viewer-pause-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  color: rgba(255,255,255,0.9);
  font-size: 34px;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 3;
  pointer-events: none;
}
.story-viewer-pause-hint.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.story-viewer-caption-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 78px;
  z-index: 3;
  padding: 0 20px;
  text-align: left;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
  padding-top: 40px;
  pointer-events: none;
}

.story-viewer-promo-title {
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  margin-bottom: 4px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.story-viewer-caption-text {
  color: rgba(255,255,255,0.92);
  font-size: 13.5px;
  line-height: 1.4;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.story-viewer-footer {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
}

.story-viewer-cta-btn {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 28px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  min-width: 60%;
  text-align: center;
}

@media (min-width: 768px) {
  .story-viewer-inner { border-radius: 16px; margin: 16px 0; height: calc(100% - 32px); }
}