/*
 * Stories — viewer, uploader, rings and owner dashboard.
 * Corners follow the theme scale: controls --radius-sm (6px), cards
 * --radius-md (10px), dialogs --radius-lg (14px). Round shapes are kept
 * only for avatars and icon-only controls.
 */

.story-upload-modal,
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 10040;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.story-upload-modal[hidden],
.story-viewer[hidden] {
  display: none;
}

body.story-viewer-open,
body.story-modal-open {
  overflow: hidden;
}

/* ── Uploader ─────────────────────────────────────────────────────── */
.story-upload-modal {
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
}

.story-upload-modal__dialog {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(100%, 460px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg, 14px);
  background: linear-gradient(180deg, #17121a 0%, #0d0c10 100%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  color: #fff;
  outline: none;
}

.story-upload-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.story-upload-modal__eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--gold-accent, #e6c46a);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.story-upload-modal h2 {
  margin: 0;
  color: #fff;
  font-size: 22px;
  line-height: 1.15;
}

.story-upload-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.story-upload-modal__close:hover,
.story-upload-modal__close:focus-visible {
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.story-upload-modal form {
  display: grid;
  gap: 14px;
}

.story-upload-modal__lede {
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 14px;
  line-height: 1.5;
}

.story-upload-modal__picker {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 150px;
  overflow: hidden;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-md, 10px);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.story-upload-modal__picker:hover,
.story-upload-modal__picker.is-dragging,
.story-upload-modal__picker:focus-within {
  border-color: var(--gold-accent, #e6c46a);
  background: rgba(230, 196, 106, 0.05);
}

.story-upload-modal__picker input[type="file"] {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.story-upload-modal__picker-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 22px 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

.story-upload-modal__picker-empty strong {
  color: #fff;
  font-size: 15px;
}

.story-upload-modal__picker-empty small {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.story-upload-modal__picker.has-file {
  border-style: solid;
  min-height: 0;
}

.story-upload-modal__picker.has-file .story-upload-modal__picker-empty {
  display: none;
}

.story-upload-modal__preview:empty {
  display: none;
}

.story-upload-modal__preview {
  display: block;
  width: 100%;
}

.story-upload-modal__preview img,
.story-upload-modal__preview video {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  background: #000;
}

.story-upload-modal__caption {
  display: grid;
  gap: 6px;
}

.story-upload-modal__label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.story-upload-modal__label small {
  color: rgba(255, 255, 255, 0.45);
  font-weight: 600;
  letter-spacing: 0;
}

.story-upload-modal__label small.is-low {
  color: var(--gold-accent, #e6c46a);
}

.story-upload-modal textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm, 6px);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
}

.story-upload-modal textarea:focus {
  outline: none;
  border-color: var(--gold-accent, #e6c46a);
}

.story-upload-modal__status {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.story-upload-modal__status:empty {
  display: none;
}

.story-upload-modal__status.is-error {
  color: #ff8b8b;
}

.story-upload-modal__progress {
  height: 3px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
}

.story-upload-modal__progress[hidden] {
  display: none;
}

.story-upload-modal__progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold-accent, #e6c46a);
  transition: width 200ms linear;
}

.story-upload-modal__submit {
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  background: var(--brand-primary, #8b0a1a);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease;
}

.story-upload-modal__submit:hover,
.story-upload-modal__submit:focus-visible {
  background: #a50e22;
}

.story-upload-modal__submit[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.story-upload-modal form.is-uploading .story-upload-modal__submit[disabled] {
  cursor: wait;
}

.story-upload-modal__note {
  margin: -4px 0 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  text-align: center;
}

/* Trim bar for videos longer than one story */
.story-trim {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md, 10px);
  background: rgba(255, 255, 255, 0.03);
}

.story-trim[hidden] {
  display: none;
}

.story-trim__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.story-trim__head strong {
  font-size: 15px;
}

.story-trim__head span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

.story-trim__modes {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm, 6px);
}

.story-trim__modes label {
  position: relative;
  display: block;
  margin: 0;
}

.story-trim__modes label[hidden] {
  display: none;
}

.story-upload-modal .story-trim__modes input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

.story-trim__modes span {
  display: block;
  padding: 9px 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.story-trim__modes label + label span {
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.story-trim__modes input:checked + span {
  background: var(--brand-primary, #8b0a1a);
  color: #fff;
}

.story-trim__modes input:focus-visible + span {
  outline: 2px solid var(--gold-accent, #e6c46a);
  outline-offset: -2px;
}

/* The track is the whole video; the window is the part that plays. */
.story-trim__track {
  position: relative;
  height: 48px;
  border-radius: var(--radius-sm, 6px);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 2px, transparent 2px 10px),
    rgba(255, 255, 255, 0.05);
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
}

.story-trim__window {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 24px;
  border: 2px solid var(--gold-accent, #e6c46a);
  border-radius: var(--radius-sm, 6px);
  background: rgba(230, 196, 106, 0.16);
  /* Dims the parts of the video that will not play; the track clips it. */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.42);
  cursor: grab;
  touch-action: none;
}

.story-trim__window[hidden] {
  display: none;
}

.story-trim__window.is-dragging {
  cursor: grabbing;
  background: rgba(230, 196, 106, 0.24);
}

.story-trim__window:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.story-trim__grip {
  position: absolute;
  top: 50%;
  width: 4px;
  height: 18px;
  margin-top: -9px;
  border-radius: 2px;
  background: var(--gold-accent, #e6c46a);
}

.story-trim__grip--start { left: 4px; }
.story-trim__grip--end { right: 4px; }

.story-trim__parts {
  position: absolute;
  inset: 0;
}

.story-trim__part {
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold-accent, #e6c46a);
  border-radius: var(--radius-sm, 6px);
  background: rgba(230, 196, 106, 0.14);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.story-trim__part + .story-trim__part {
  border-left-width: 1px;
}

.story-trim__playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.story-trim__times {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.story-trim__times span:last-child {
  color: rgba(255, 255, 255, 0.5);
}

.story-trim__note {
  margin: 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

/* Weekly contest panel */
.story-contest {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(230, 196, 106, 0.28);
  border-radius: var(--radius-md, 10px);
  background:
    linear-gradient(135deg, rgba(139, 10, 26, 0.35) 0%, rgba(139, 10, 26, 0) 60%),
    rgba(255, 255, 255, 0.02);
}

.story-contest[hidden] {
  display: none;
}

.story-contest__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.story-contest__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gold-accent, #e6c46a);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-contest__clock {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-badge, 4px);
  background: rgba(0, 0, 0, 0.35);
  font-variant-numeric: tabular-nums;
}

.story-contest__clock small {
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}

.story-contest__clock strong {
  font-size: 13px;
}

.story-contest__prize {
  margin: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.story-contest__prize span {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 400;
}

.story-contest__board {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border-radius: var(--radius-sm, 6px);
  background: rgba(255, 255, 255, 0.06);
}

.story-contest__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(10, 9, 12, 0.85);
}

.story-contest__row img,
.story-contest__dot {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-accent, #e6c46a);
}

.story-contest__dot {
  background: rgba(255, 255, 255, 0.08);
}

.story-contest__who {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}

.story-contest__who small {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.story-contest__who strong {
  overflow: hidden;
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.story-contest__likes {
  display: grid;
  justify-items: end;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.story-contest__likes strong {
  font-size: 16px;
}

.story-contest__likes small {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}

.story-contest__row.is-you .story-contest__who small,
.story-contest__row--you .story-contest__who small {
  color: var(--gold-accent, #e6c46a);
}

.story-contest__empty,
.story-contest__last {
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

.story-contest__empty {
  padding: 10px;
  background: rgba(10, 9, 12, 0.85);
}

/* ── Viewer ───────────────────────────────────────────────────────── */
.story-viewer {
  display: grid;
  place-items: center;
}

.story-viewer__surface {
  position: relative;
  width: min(100vw, 430px);
  height: min(100vh, 780px);
  overflow: hidden;
  background: #050505;
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  color: #fff;
  outline: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.story-viewer__media,
.story-viewer__media img,
.story-viewer__media video {
  width: 100%;
  height: 100%;
}

.story-viewer__media img,
.story-viewer__media video {
  display: block;
  object-fit: contain;
  background: #050505;
  pointer-events: none;
}

.story-viewer__shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 22%),
    linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0) 34%);
}

.story-viewer.is-loading .story-viewer__surface::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: #fff;
  border-radius: 50%;
  animation: story-spin 0.8s linear infinite;
  pointer-events: none;
}

.story-viewer__status {
  position: absolute;
  top: 50%;
  left: 24px;
  right: 24px;
  z-index: 5;
  transform: translateY(-50%);
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.86);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.story-viewer__status:empty {
  display: none;
}

.story-viewer__tap {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.story-viewer__tap:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: -6px;
}

.story-viewer__tap--prev { left: 0; width: 32%; }
.story-viewer__tap--next { right: 0; width: 68%; }

.story-viewer__top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  padding: max(12px, env(safe-area-inset-top)) 12px 0;
}

.story-viewer__progress {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.story-viewer__progress span {
  position: relative;
  flex: 1;
  height: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.32);
}

.story-viewer__progress i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: #fff;
}

.story-viewer__progress span.is-complete i {
  width: 100%;
}

.story-viewer.is-timing .story-viewer__progress span.is-active i {
  animation: story-fill 5s linear forwards;
}

.story-viewer.is-paused .story-viewer__progress span.is-active i,
.story-viewer.is-loading .story-viewer__progress span.is-active i {
  animation-play-state: paused;
}

.story-viewer__header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-viewer__owner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  color: #fff !important;
  text-decoration: none !important;
}

.story-viewer__avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.85);
}

.story-viewer__owner-text {
  display: grid;
  min-width: 0;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.story-viewer__owner-text strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.story-viewer__owner-text span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.story-viewer__controls {
  display: flex;
  gap: 4px;
}

.story-viewer__control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: #fff;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.story-viewer__control:hover,
.story-viewer__control:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

.story-viewer__control[hidden] {
  display: none;
}

.story-viewer__icon-play,
.story-viewer.is-paused .story-viewer__icon-pause,
.story-viewer__sound-off,
.story-viewer.is-muted .story-viewer__sound-waves {
  display: none;
}

.story-viewer.is-paused .story-viewer__icon-play,
.story-viewer.is-muted .story-viewer__sound-off {
  display: inline;
}

.story-viewer__bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: grid;
  gap: 12px;
  padding: 0 14px max(16px, env(safe-area-inset-bottom));
}

.story-viewer__caption {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  overflow-wrap: anywhere;
}

.story-viewer__caption[hidden],
.story-viewer__cta[hidden],
.story-viewer__like[hidden] {
  display: none;
}

.story-viewer__actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.story-viewer__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm, 6px);
  color: #fff !important;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease;
}

.story-viewer__cta--primary {
  flex: 1 1 auto;
  background: var(--brand-primary, #8b0a1a);
  border: 1px solid var(--brand-primary, #8b0a1a);
}

.story-viewer__cta--primary:hover,
.story-viewer__cta--primary:focus-visible {
  background: #a50e22;
  border-color: #a50e22;
}

.story-viewer__cta--secondary {
  flex: 0 1 auto;
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.story-viewer__cta--secondary:hover,
.story-viewer__cta--secondary:focus-visible {
  border-color: rgba(255, 255, 255, 0.7);
}

/* Like CTA: same geometry as View profile; the heart fills when liked and
   the count sits quietly after the label. */
.story-viewer__cta--secondary.story-viewer__like {
  flex: 0 0 auto;
  min-width: 112px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.story-viewer__like svg path {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 2;
  transition: fill 160ms ease, stroke 160ms ease;
}

.story-viewer__like.is-liked {
  border-color: rgba(255, 51, 85, 0.7);
}

.story-viewer__like.is-liked svg path {
  fill: #ff3355;
  stroke: #ff3355;
}

.story-viewer__like.is-popping svg {
  animation: story-like-pop 380ms cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.story-viewer__like-count {
  padding-left: 8px;
  margin-left: 2px;
  border-left: 1px solid rgba(255, 255, 255, 0.24);
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.story-viewer__like-count:empty {
  display: none;
}

.story-viewer__like.is-own,
.story-viewer__like[disabled] {
  cursor: default;
  opacity: 0.7;
}

.story-viewer__like:focus-visible,
.story-viewer__cta:focus-visible {
  outline: 2px solid var(--gold-accent, #e6c46a);
  outline-offset: 2px;
}

.story-viewer__burst {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  color: #ff3355;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.4);
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.45));
}

.story-viewer__burst.is-bursting {
  animation: story-burst 760ms ease-out forwards;
}

@keyframes story-fill {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes story-spin {
  to { transform: rotate(360deg); }
}

@keyframes story-like-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes story-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  45% { transform: translate(-50%, -50%) scale(0.96); }
  75% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(1); }
}

/* ── Rings ────────────────────────────────────────────────────────── */
.online-story--has-story .online-story__avatar {
  background: conic-gradient(from 210deg, #e6c46a, #dd2a7b, #8b0a1a, #e6c46a);
}

.online-story--has-story.is-story-seen .online-story__avatar {
  background: rgba(255, 255, 255, 0.28);
}

/* The story frame sits over the profile photo inside the same circle.
   Doubled class beats the theme's `.online-story__avatar img` sizing. */
.online-story__avatar .online-story__story-frame {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  border: 3px solid var(--bg-primary, #0f0f0f);
  border-radius: 50%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

.online-story__story-frame--image {
  animation: story-ring-swap 7s ease-in-out 1.2s infinite;
}

.online-story__avatar.is-story-playing video.online-story__story-frame {
  opacity: 1;
}

.online-story__avatar .online-story__indicator {
  z-index: 2;
}

@keyframes story-ring-swap {
  0%, 38% { opacity: 0; }
  48%, 88% { opacity: 1; }
  98%, 100% { opacity: 0; }
}

.online-story--offline .online-story__avatar img {
  filter: saturate(0.9);
}

/* Profile hero story button */
.profile-page .profile-hero__nav-tl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-hero__story-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px 0 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full, 999px);
  background: rgba(8, 6, 11, 0.52);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.profile-hero__story-btn:hover,
.profile-hero__story-btn:focus-visible {
  background: rgba(139, 10, 26, 0.3);
  border-color: rgba(139, 10, 26, 0.55);
}

.profile-hero__story-ring {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 4px, transparent 5px),
    radial-gradient(circle, rgba(8, 6, 11, 0.9) 0 9px, transparent 10px),
    conic-gradient(from 210deg, #e6c46a, #dd2a7b, #8b0a1a, #e6c46a);
}

.profile-hero__story-btn.is-story-seen .profile-hero__story-ring {
  background:
    radial-gradient(circle, #fff 0 4px, transparent 5px),
    radial-gradient(circle, rgba(8, 6, 11, 0.9) 0 9px, transparent 10px),
    rgba(255, 255, 255, 0.35);
}

.profile-tier-badge--hottest {
  background: linear-gradient(135deg, #ab1c2f, #e6c46a);
  color: #fff;
}

.story-upload-trigger,
.profile-account__action--story {
  cursor: pointer;
}

/* ── Compact owner dashboard ──────────────────────────────────────── */
.story-dashboard__empty {
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.6);
}

.story-dashboard__empty[hidden] {
  display: none;
}

.story-dashboard__grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  margin-top: 16px;
}

.story-dashboard__grid:empty {
  display: none;
}

.story-dashboard__item {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md, 10px);
  background: rgba(255, 255, 255, 0.03);
}

.story-dashboard__item.is-pending {
  border-style: dashed;
}

.story-dashboard__media {
  display: grid;
  place-items: center;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: var(--radius-sm, 6px);
  background: #111;
  color: rgba(255, 255, 255, 0.7);
  font-size: 22px;
}

.story-dashboard__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-dashboard__meta {
  display: grid;
  gap: 2px;
  font-size: 12px;
  line-height: 1.3;
}

.story-dashboard__meta span {
  color: rgba(255, 255, 255, 0.6);
}

.story-dashboard__delete {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm, 6px);
  background: transparent;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.story-dashboard__delete:hover,
.story-dashboard__delete:focus-visible {
  border-color: rgba(139, 10, 26, 0.7);
  background: rgba(139, 10, 26, 0.25);
}

.story-dashboard__delete[disabled] {
  opacity: 0.5;
  cursor: wait;
}

@media (max-width: 640px) {
  .story-viewer__surface {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }

  .story-upload-modal {
    align-items: end;
    padding: 0;
  }

  .story-upload-modal__dialog {
    width: 100%;
    max-height: 94dvh;
    border-radius: var(--radius-lg, 14px) var(--radius-lg, 14px) 0 0;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-upload-modal,
  .story-viewer {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .online-story__story-frame--image,
  .story-viewer__burst.is-bursting,
  .story-viewer__like.is-popping svg {
    animation: none;
  }
}

/* ── Brand stories (announcements, adverts, polls) ────────────────── */
.story-viewer[data-theme="crimson"] .story-viewer__surface { --story-card-bg: linear-gradient(160deg, #8b0a1a 0%, #2a0409 100%); }
.story-viewer[data-theme="gold"] .story-viewer__surface { --story-card-bg: linear-gradient(160deg, #e6c46a 0%, #7a5a14 100%); }
.story-viewer[data-theme="midnight"] .story-viewer__surface { --story-card-bg: linear-gradient(160deg, #1d2140 0%, #07080f 100%); }
.story-viewer[data-theme="rose"] .story-viewer__surface { --story-card-bg: linear-gradient(160deg, #dd2a7b 0%, #4a0b2c 100%); }

.story-viewer.has-card-only .story-viewer__surface {
  background: var(--story-card-bg, #050505);
}

.story-viewer.is-house:not(.has-card-only) .story-viewer__shade {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 22%),
    linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.72) 30%, rgba(0, 0, 0, 0) 55%);
}

.story-viewer.has-card-only .story-viewer__shade {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0) 20%);
}

.story-viewer__card {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 118px;
  z-index: 3;
  display: grid;
  gap: 10px;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.story-viewer__card[hidden] {
  display: none;
}

.story-viewer.has-card-only .story-viewer__card {
  top: 50%;
  bottom: auto;
  transform: translateY(-58%);
}

.story-viewer__surface:has(.story-viewer__poll:not([hidden])) .story-viewer__card {
  top: 26%;
  bottom: auto;
  transform: none;
}

.story-viewer__card-kind {
  justify-self: start;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-badge, 4px);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: none;
}

.story-viewer__card-kind:empty {
  display: none;
}

.story-viewer__card-title {
  margin: 0;
  color: #fff;
  font-size: clamp(26px, 7vw, 32px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.story-viewer__card-body {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.story-viewer__card-body[hidden] {
  display: none;
}

.story-viewer.is-house .story-viewer__cta--primary {
  background: #fff;
  border-color: #fff;
  color: var(--brand-primary, #8b0a1a) !important;
}

.story-viewer.is-house .story-viewer__cta--primary:hover,
.story-viewer.is-house .story-viewer__cta--primary:focus-visible {
  background: #f3e6e8;
  border-color: #f3e6e8;
}

.story-viewer.is-house .story-viewer__cta--primary[hidden] + .story-viewer__like {
  margin-left: auto;
}

/* Poll */
.story-viewer__poll {
  display: grid;
  gap: 8px;
}

.story-viewer__poll[hidden] {
  display: none;
}

.story-viewer__poll-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-sm, 6px);
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}

.story-viewer__poll-option:hover,
.story-viewer__poll-option:focus-visible {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.story-viewer__poll-option:active {
  transform: scale(0.99);
}

.story-viewer__poll-option:focus-visible {
  outline: 2px solid var(--gold-accent, #e6c46a);
  outline-offset: 2px;
}

.story-viewer__poll-option[disabled] {
  cursor: default;
  color: #fff;
  opacity: 1;
}

.story-viewer__poll-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(255, 255, 255, 0.2);
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.story-viewer__poll-option.is-chosen {
  border-color: var(--gold-accent, #e6c46a);
}

.story-viewer__poll-option.is-chosen .story-viewer__poll-fill {
  background: rgba(230, 196, 106, 0.38);
}

.story-viewer__poll-label,
.story-viewer__poll-share {
  position: relative;
}

.story-viewer__poll-share {
  font-variant-numeric: tabular-nums;
}

.story-viewer__poll-option.is-chosen .story-viewer__poll-label::after {
  content: " ✓";
  color: var(--gold-accent, #e6c46a);
}

.story-viewer__poll-total {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  text-align: right;
}

/* Brand ring: crimson, distinct from the green online rings and the gold/pink
   escort story rings. A lighter crimson highlight sweeps round the ring so
   it reads as brand red rather than an error state. */
.online-story--house .online-story__avatar {
  background: conic-gradient(from 210deg, #6e0816 0deg, #b3122b 90deg, #e8475f 150deg, #b3122b 210deg, #8b0a1a 290deg, #6e0816 360deg);
  box-shadow: 0 0 0 1px rgba(232, 71, 95, 0.25), 0 6px 18px rgba(139, 10, 26, 0.45);
}

.online-story--house:hover .online-story__avatar,
.online-story--house:focus-visible .online-story__avatar {
  box-shadow: 0 0 0 1px rgba(232, 71, 95, 0.45), 0 8px 22px rgba(179, 18, 43, 0.6);
}

.online-story--house.is-story-seen .online-story__avatar {
  background: rgba(139, 10, 26, 0.55);
  box-shadow: none;
}

.online-story--house .online-story__avatar img {
  background: #1a0508;
}

.online-story__house-mark {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 3px solid var(--bg-primary, #0f0f0f);
  border-radius: 50%;
  background: var(--brand-primary, #8b0a1a);
  color: #fff;
  font-size: 26px;
  font-weight: 800;
}

.online-story--house .online-story__name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  font-weight: 700;
}

.online-story--house .online-story__name::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e8475f;
  box-shadow: 0 0 6px rgba(232, 71, 95, 0.8);
}

.online-story--house.is-story-seen .online-story__name::before {
  background: rgba(232, 71, 95, 0.45);
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .story-viewer__poll-fill {
    transition: none;
  }
}
