/* ─── STORIES: RAIL ─── */
#stories-rail { padding: 16px 0 4px; }
#stories-rail.is-empty { display: none; }

.stories-rail {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 2px 20px 6px;
  scrollbar-width: none;
}
.stories-rail::-webkit-scrollbar { display: none; }

.story-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 64px;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 0;
}
.story-chip:active .story-ring { transform: scale(0.94); }

.story-ring {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  padding: 2.5px;
  background: var(--accent2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.story-chip.featured .story-ring {
  padding: 3px;
  box-shadow: 0 0 0 1px var(--accent2);
}

.story-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-initials {
  font-size: 15px;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: 0.02em;
}

.story-star {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent2);
  border: 2px solid var(--bg);
  color: var(--bg);
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-name {
  font-size: 10.5px;
  color: var(--text2);
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.story-chip.featured .story-name { color: var(--text); font-weight: 500; }

/* ─── STORIES: FULLSCREEN VIEWER ─── */
.story-viewer {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  margin: 0;
  border: none;
  padding: 0;
  width: 100vw;
  width: var(--app-vw, 100vw);
  height: 100dvh;
  height: var(--app-vh, 100dvh);
  max-width: none;
  max-height: none;
  z-index: 500;
  background: #000;
  color: inherit;
  display: flex;
  flex-direction: column;
  outline: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.story-viewer::backdrop {
  background: transparent;
}

body.nav-locked #app {
  pointer-events: none;
}

.story-viewer-header {
  position: relative;
  z-index: 2;
  padding: calc(var(--safe-t) + 10px) 14px 0;
}

.story-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}
.story-progress-seg {
  flex: 1;
  height: 2.5px;
  border-radius: 2px;
  background: rgba(255,255,255,0.25);
  overflow: hidden;
}
.story-progress-fill {
  height: 100%;
  width: 0%;
  background: #fff;
}

.story-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.story-meta-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg4);
  flex-shrink: 0;
}
.story-meta-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-meta-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
}
.story-featured-pill {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #000;
  background: #fff;
  padding: 3px 8px;
  border-radius: 20px;
}
.story-meta-time {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}
.story-close {
  margin-left: auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.story-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}
.story-media {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;

  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
}

.story-pause-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: none;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.1s;
}
.story-pause-btn svg { width: 16px; height: 16px; }
.story-pause-btn:active { transform: scale(0.9); }
.story-pause-btn.is-paused { color: #fff; }

.story-nav {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  pointer-events: none;
}
.story-nav-zone {
  flex: 1;
  height: 100%;
  pointer-events: auto;
  touch-action: manipulation;
}

.story-link-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-b) + 20px);
  z-index: 3;
  display: flex;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  transform: translateY(4px);
}
.story-link-wrap.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

.story-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  color: #000;
  padding: 11px 20px;
  border-radius: 24px;
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  transition: transform 0.12s;
}
.story-link-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.story-link-btn:active { transform: scale(0.95); }