.forum-avatar.has-story,
.profile-photo.has-story {
  cursor: pointer;
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--story-ring, #fff), 0 0 12px 4px var(--story-ring, #fff);
  animation: story-pop 520ms ease-out 1;
}
.profile-photo.has-story { box-shadow: 0 0 0 3px #000, 0 0 0 6px var(--story-ring, #fff), 0 0 26px 8px var(--story-ring, #fff); }
.forum-avatar.has-story.is-story-seen,
.profile-photo.has-story.is-story-seen { box-shadow: 0 0 0 2px #000, 0 0 0 4px rgba(255, 255, 255, .38); animation: none; }
@keyframes story-pop {
  0% { box-shadow: 0 0 0 2px #000, 0 0 0 2px var(--story-ring, #fff), 0 0 0 0 transparent; }
  60% { box-shadow: 0 0 0 2px #000, 0 0 0 5px var(--story-ring, #fff), 0 0 22px 9px var(--story-ring, #fff); }
}
@media (prefers-reduced-motion: reduce) { .forum-avatar.has-story, .profile-photo.has-story { animation: none; } }

.story-tray:empty { display: none; }
.story-tray { display: flex; gap: 14px; margin: 4px 0 14px; padding: 10px 6px 8px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.story-tray::-webkit-scrollbar { display: none; }
.story-tray[hidden] { display: none; }
.story-tray-item { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 70px; }
:is(#terminal, body) .story-tray-open { display: block; width: 58px; height: 58px; min-height: 0; margin: 4px; padding: 0; border: 0; border-radius: 50%; background: transparent; box-shadow: none; cursor: pointer; }
.story-tray-open .forum-avatar { width: 58px !important; height: 58px !important; }
.story-tray-open .forum-avatar img, .story-tray-open .forum-avatar svg { width: 100%; height: 100%; }
.story-tray-open:active .forum-avatar { transform: translate(1px, 1px); }
.story-tray, .story-tray-name { font-family: Terminal, "Courier New", monospace; }
:is(#terminal, body) .story-tray-plus { position: absolute; top: 44px; left: 44px; display: grid; place-items: center; width: 22px; height: 22px; min-height: 0; padding: 0; border: 2px solid #000; border-radius: 50%; background: var(--my-accent, #fff); color: var(--my-accent-ink, #000); font: 700 17px/1 inherit; box-shadow: none; cursor: pointer; }
.story-tray-item.is-uploading .forum-avatar { opacity: .55; }
.story-tray-name { max-width: 70px; overflow: hidden; color: inherit; font-size: 13px; line-height: 1.1; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

html.is-story-open, html.is-story-open body { overflow: hidden; }
.story-viewer { position: fixed; inset: 0; z-index: 2147482000; display: grid; place-items: center; background: #000; color: #fff; font-family: Terminal, "Courier New", monospace; touch-action: none; overscroll-behavior: contain; }
.story-stage { position: relative; width: min(100vw, calc(100dvh * 9 / 16)); height: 100dvh; max-height: 100dvh; overflow: hidden; background: #000; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: opacity 120ms linear; }
@media (min-width: 700px) { .story-stage { height: calc(100dvh - 40px); width: min(100vw, calc((100dvh - 40px) * 9 / 16)); border: 3px solid #000; box-shadow: 0 0 0 2px var(--story-ring, #fff), 0 0 30px 4px var(--story-ring, #fff); } }
.story-media { position: absolute; inset: 0; }
.story-frame { position: absolute; left: 0; top: 0; width: 100%; height: 100%; container-type: inline-size; }
.story-photo, .story-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; -webkit-user-drag: none; pointer-events: none; }
.story-texts { position: absolute; inset: 0; pointer-events: none; }
.story-text { position: absolute; box-sizing: border-box; max-width: 92%; padding: .12em .4em .18em; border: 2px solid #000; background: rgba(20, 20, 20, .82); color: #fff; font: 6.4cqw/1.15 Terminal, "Courier New", monospace; text-align: center; white-space: pre-wrap; overflow-wrap: anywhere; transform: translate(-50%, -50%); box-shadow: 3px 3px 0 #000; pointer-events: none; }
.story-compose .story-text { pointer-events: auto; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.story-compose .story-text:active { cursor: grabbing; }
.story-photo[hidden], .story-video[hidden] { display: none; }
.story-bars { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 8px; right: 8px; display: flex; gap: 4px; pointer-events: none; }
.story-bar { flex: 1; height: 3px; overflow: hidden; background: rgba(255, 255, 255, .35); }
.story-fill { display: block; height: 100%; background: #fff; }
.story-head { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 18px); left: 8px; right: 8px; display: flex; align-items: center; gap: 8px; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.story-who { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 18px; }
.story-who .forum-avatar { width: 32px !important; height: 32px !important; box-shadow: 0 0 0 2px #000, 0 0 0 3px var(--story-ring, #fff); }
.story-who b { overflow: hidden; font-weight: normal; text-overflow: ellipsis; white-space: nowrap; }
.story-age { flex: none; font-size: 15px; opacity: .8; }
.story-head-gap { flex: 1; }
:is(#terminal, body) .story-btn { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; min-height: 0; padding: 0; border: 2px solid #000; border-radius: 0; background: #3a3a3a; color: #fff; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .18), inset -2px -2px 0 rgba(0, 0, 0, .3), 3px 3px 0 #000; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:is(#terminal, body) .story-btn:active { transform: translate(2px, 2px); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .3), inset -2px -2px 0 rgba(255, 255, 255, .18); }
:is(#terminal, body) .story-btn[hidden] { display: none; }
.story-btn svg { width: 20px; height: 20px; fill: currentColor; shape-rendering: crispEdges; }
.story-caption { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 80px); margin: 0; padding: 8px 12px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 19px; line-height: 1.3; text-align: center; overflow-wrap: anywhere; pointer-events: none; }
.story-caption[hidden] { display: none; }
.story-own { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); display: flex; justify-content: center; gap: 12px; }
.story-own[hidden] { display: none; }
:is(#terminal, body) .story-pill { box-sizing: border-box; min-height: 44px; padding: 0 16px; border: 2px solid #000; border-radius: 0; background: #3a3a3a; color: #fff; font: inherit; font-size: 20px; line-height: 1.1; white-space: nowrap; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .18), inset -2px -2px 0 rgba(0, 0, 0, .3), 3px 3px 0 #000; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:is(#terminal, body) .story-pill.is-share, :is(#terminal, body) .story-pill[data-own-add] { background: var(--story-ring, #3a3a3a); color: #000; }
:is(#terminal, body) .story-pill:active { transform: translate(2px, 2px); box-shadow: inset 2px 2px 0 rgba(0, 0, 0, .3), inset -2px -2px 0 rgba(255, 255, 255, .18); }
.story-stage.is-held .story-head, .story-stage.is-held .story-bars, .story-stage.is-held .story-own { opacity: 0; transition: opacity 160ms linear; }
.story-compose-bar { position: absolute; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); display: flex; justify-content: flex-end; gap: 10px; }
.social-story-text-input { box-sizing: border-box; display: block; width: 100%; min-height: 48px; margin: 0 0 14px; padding: 4px 8px; border: 2px solid #000; border-radius: 0; background: #2a2a2e; color: #fff; font: inherit; font-size: 24px; }
.story-caption-input { flex: 1; min-width: 0; min-height: 40px; padding: 0 12px; border: 2px solid #000; border-radius: 0; background: rgba(0, 0, 0, .6); color: #fff; font: inherit; font-size: 17px; }
.story-caption-input::placeholder { color: rgba(255, 255, 255, .6); }
