/* NAV_R2: an optional 80px strip; no content means no reserved height. */
#app #chat-stories { box-sizing: border-box; display: flex; flex: 0 0 80px; height: 80px; min-height: 0; max-height: 80px; gap: 10px; padding: 4px 12px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; touch-action: pan-x; scrollbar-width: none; background: var(--surface); }
#app #chat-stories[hidden], #app #btn-chat-stories[hidden] { display: none !important; }
#app #chat-stories::-webkit-scrollbar { display: none; }
#app .chat-story { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; flex: 0 0 60px; min-width: 44px; min-height: 44px; border: 0; padding: 0; background: transparent; color: var(--text); cursor: pointer; }
#app .chat-story__ring { display: grid; place-items: center; box-sizing: border-box; flex: 0 0 48px; width: 48px; height: 48px; padding: 2px; border: 2px solid var(--accent); border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 18px; font-weight: 600; line-height: 1; }
#app .chat-story__ring img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
#app .chat-story__name { display: block; width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 14px; }
#app .chat-story:focus-visible, #app #btn-chat-stories:focus-visible { outline: 3px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
.story-viewer { box-sizing: border-box; width: min(680px, calc(100vw - 32px)); max-width: none; height: min(860px, calc(100dvh - 32px)); max-height: none; margin: auto; padding: 0; border: 1px solid var(--border); border-radius: 22px; overflow: hidden; background: var(--surface); color: var(--text); box-shadow: 0 24px 100px rgba(0,0,0,.4); }
.story-viewer::backdrop { background: rgba(0,0,0,.68); }
.story-viewer:not([open]) { display: none; }
.story-viewer__shell { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.story-viewer__header { display: flex; align-items: center; flex: 0 0 auto; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.story-viewer__author { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 4px; }
.story-viewer__author strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-viewer__author time { font-size: 12px; color: var(--text-muted); }
.story-viewer button, .story-viewer a { box-sizing: border-box; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; line-height: 1.4; text-decoration: none; cursor: pointer; }
.story-viewer a:not([href]) { display: none; }
.story-viewer button[hidden] { display: none; }
.story-viewer button:disabled { opacity: .45; cursor: default; }
.story-viewer button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink, var(--accent)); border-color: var(--accent); }
.story-viewer :is(button,a,video):focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.story-viewer__stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1 1 auto; min-height: 80px; overflow: hidden; background: var(--surface-2); }
.story-viewer__media { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; touch-action: pan-y pinch-zoom; }
.story-viewer__media:empty { height: 0; }
.story-viewer__media img, .story-viewer__media video { display: block; max-width: 100%; max-height: 100%; width: 100%; height: 100%; object-fit: contain; }
.story-viewer__media video { touch-action: auto; }
.story-viewer__status { flex: 0 0 auto; margin: 0; padding: 8px 16px; max-width: 100%; text-align: center; font-size: 14px; line-height: 1.45; }
.story-viewer__status:empty { display: none; }
.story-viewer__retry { flex: 0 0 auto; margin: 8px 12px 16px; }
.story-viewer__caption { flex: 0 1 auto; max-height: 18dvh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px 14px; font-size: 14px; line-height: 1.5; }
.story-viewer__caption:empty { display: none; }
.story-viewer__controls { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding: 8px 12px max(8px, var(--safe-bottom, 0px)); border-top: 1px solid var(--border); }
.story-viewer__controls [data-story-like] { flex: 1; }
@media (max-width: 860px) {
  .story-viewer { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: none; }
  .story-viewer__header { padding-top: max(8px, var(--safe-top, 0px)); }
}
@media (prefers-reduced-motion: reduce) { .story-viewer *, #chat-stories * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
