/*
 * 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;
  }
}

/* ── Uploader refresh: flat charcoal, 6px corners, crimson only for Publish ── */
.story-upload-modal {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.story-upload-modal__dialog {
  gap: 18px;
  width: min(100%, 480px);
  padding: 24px;
  border-radius: 8px;
  background: #151515;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  font-family: 'Manrope', system-ui, sans-serif;
}

.story-upload-modal__head {
  align-items: center;
}

.story-upload-modal h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.story-upload-modal__close {
  border: 0;
  border-radius: 6px;
  color: #9A9A9A;
}

.story-upload-modal__close:hover,
.story-upload-modal__close:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: #FFF;
}

.story-upload-modal__lede {
  margin-top: -8px;
  color: #9A9A9A;
}

.story-upload-modal__picker {
  min-height: 200px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: #111;
}

.story-upload-modal__picker:hover,
.story-upload-modal__picker.is-dragging,
.story-upload-modal__picker:focus-within {
  border-color: rgba(255, 255, 255, 0.45);
  background: #161616;
}

.story-upload-modal__picker.is-dragging {
  border-style: solid;
}

.story-upload-modal__picker-empty {
  gap: 4px;
}

.story-upload-modal__picker-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  color: #ECECEC;
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.story-upload-modal__picker:hover .story-upload-modal__picker-icon,
.story-upload-modal__picker.is-dragging .story-upload-modal__picker-icon {
  transform: translateY(-2px);
}

.story-upload-modal__picker-hint {
  color: #9A9A9A;
  font-size: 13px;
}

.story-upload-modal__picker-empty small {
  margin-top: 6px;
  color: #7A7A7A;
}

.story-upload-modal__preview img,
.story-upload-modal__preview video {
  max-height: 360px;
  border-radius: 6px;
}

.story-upload-modal__label {
  color: #B4B4B4;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

.story-upload-modal__label small.is-low {
  color: #FF9B9B;
}

.story-upload-modal textarea {
  border-color: rgba(255, 255, 255, 0.16);
  background: #111;
}

.story-upload-modal textarea:focus {
  border-color: #B4B4B4;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.story-upload-modal__progress span {
  background: #B80F29;
}

.story-upload-modal__submit {
  border-radius: 6px;
  background: #B80F29;
  font-weight: 800;
}

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

.story-upload-modal__note {
  color: #7A7A7A;
}

.story-trim,
.story-contest {
  border-radius: 6px;
}

.story-trim__modes input:checked + span {
  background: #ECECEC;
  color: #111;
}

.story-trim__modes input:focus-visible + span {
  outline-color: #ECECEC;
}

.story-trim__window {
  border-color: #ECECEC;
  background: rgba(255, 255, 255, 0.1);
}

.story-trim__window.is-dragging {
  background: rgba(255, 255, 255, 0.18);
}

.story-trim__grip {
  background: #ECECEC;
}

.story-trim__part {
  border-color: #ECECEC;
  background: rgba(255, 255, 255, 0.1);
}

@media (max-width: 640px) {
  .story-upload-modal__dialog {
    padding: 20px 16px max(20px, env(safe-area-inset-bottom));
    border-radius: 8px 8px 0 0;
  }

  .story-upload-modal__picker {
    min-height: 170px;
  }
}

/* Playback polish (30 Sep): a blurred cover under the media (no black flash
   while loading; letterboxed stories framed by their own colours), and a
   clean view while the story is held. */
.story-viewer__media {
  position: relative;
  overflow: hidden;
}

.story-viewer__backdrop {
  position: absolute;
  inset: -8%;
  z-index: 0;
  background-position: center;
  background-size: cover;
  filter: blur(28px) brightness(.55) saturate(1.1);
  transform: scale(1.1);
  pointer-events: none;
}

.story-viewer__media img,
.story-viewer__media video {
  position: relative;
  z-index: 1;
  background: transparent;
}

.story-viewer__top,
.story-viewer__bottom {
  transition: opacity .2s ease;
}

.story-viewer.is-holding .story-viewer__top,
.story-viewer.is-holding .story-viewer__bottom {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .story-viewer__top,
  .story-viewer__bottom {
    transition: none;
  }
}

/* Captions: two lines with "more"; expanded, they scroll within a readable
   shade and the story waits (30 Sep). */
.story-viewer__caption-wrap {
  display: grid;
  gap: 4px;
  justify-items: start;
}

.story-viewer__caption {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.story-viewer__caption.is-expanded {
  display: block;
  max-height: 38vh;
  overflow-y: auto;
  -webkit-line-clamp: unset;
  overscroll-behavior: contain;
}

.story-viewer__more {
  min-height: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.story-viewer__more:hover,
.story-viewer__more:focus-visible {
  color: #fff;
}

.story-viewer__more:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
  border-radius: 3px;
}

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

/* While a caption is open, a soft shade lifts it off the media. */
.story-viewer.is-reading .story-viewer__bottom {
  padding-top: 40px;
  background: linear-gradient(180deg, rgba(5, 5, 5, 0) 0%, rgba(5, 5, 5, 0.78) 30%);
}

/* ==================================================================
   Story composer (30 Sep). The story itself is the hero: a 9:16 frame
   that previews exactly what visitors get (ring, name, story bars,
   caption), which is also the drop target. Details sit in a quiet side
   panel; the weekly contest becomes a race track. Mobile is a full-
   screen composer with a sticky Publish bar.
   ================================================================== */
.story-upload-modal__dialog.story-composer {
  display: block;
  gap: 0;
  width: min(100%, 820px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #151515;
}

.story-composer .story-composer__form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0;
  max-height: calc(100dvh - 34px);
}

.story-composer__sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── Stage ── */
.story-composer__stage-col {
  display: grid;
  place-items: center;
  padding: 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: radial-gradient(120% 70% at 50% 0%, #1d1a1b 0%, #0f0f0f 70%);
}

.story-upload-modal__picker.story-composer__stage {
  position: relative;
  display: block;
  isolation: isolate;
  height: min(560px, calc(100dvh - 76px));
  min-height: 0;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: #0b0b0b;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.9);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.story-upload-modal__picker.story-composer__stage:hover,
.story-upload-modal__picker.story-composer__stage:focus-within {
  border-color: rgba(255, 255, 255, 0.22);
  background: #0b0b0b;
}

.story-upload-modal__picker.story-composer__stage:has(input:focus-visible) {
  outline: 2px solid #ECECEC;
  outline-offset: 3px;
}

.story-upload-modal__picker.story-composer__stage.is-dragging {
  border-style: solid;
  border-color: #ECECEC;
  transform: scale(1.015);
}

.story-composer__stage::after {
  content: '';
  position: absolute;
  inset: 10px;
  z-index: 6;
  border: 1.5px dashed rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.story-composer__stage.is-dragging::after {
  opacity: 1;
}

.story-composer__stage input[type="file"] {
  z-index: 7;
}

.story-composer__backdrop {
  position: absolute;
  inset: -24px;
  z-index: 0;
  background:
    var(--story-media, var(--story-owner-image, none)) center / cover no-repeat,
    radial-gradient(110% 70% at 50% 10%, #2b2426 0%, #121012 75%);
  filter: blur(26px) saturate(0.85) brightness(0.42);
  transform: scale(1.08);
  transition: filter 0.4s ease;
}

.story-composer__stage.has-file .story-composer__backdrop {
  filter: blur(30px) saturate(1) brightness(0.5);
}

.story-composer__stage .story-upload-modal__preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
}

.story-composer__stage .story-upload-modal__preview img,
.story-composer__stage .story-upload-modal__preview video {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
  background: transparent;
  animation: story-composer-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes story-composer-in {
  from { opacity: 0; transform: scale(1.04); }
  to { opacity: 1; transform: none; }
}

.story-composer__shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 22%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 30%);
  pointer-events: none;
}

/* Story chrome, as the viewer draws it */
.story-composer__chrome {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  display: grid;
  gap: 10px;
  padding: 12px 12px 0;
  pointer-events: none;
}

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

.story-composer__bars i {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.32);
  transition: background-color 0.3s ease;
}

.story-composer__stage.has-file .story-composer__bars i:first-child {
  background: #fff;
}

.story-upload-modal__progress.story-composer__upload {
  position: absolute;
  top: 12px;
  right: 12px;
  left: 12px;
  height: 2px;
  border-radius: 0;
  background: transparent;
}

.story-composer__upload span {
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.story-composer__owner {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.story-composer__ring {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 2px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, #e6c46a, #dd2a7b, #8b0a1a, #e6c46a);
}

.story-composer__ring::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: #151515;
}

.story-composer__ring img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid #151515;
  border-radius: 50%;
  object-fit: cover;
}

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

.story-composer__owner-text strong {
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Empty stage */
.story-composer__stage .story-composer__empty {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  padding: 24px;
  color: #ECECEC;
  text-align: center;
  pointer-events: none;
}

.story-composer__stage .story-composer__add {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 0 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.story-composer__stage:hover .story-composer__add,
.story-composer__stage.is-dragging .story-composer__add {
  border-color: #fff;
  background: #fff;
  color: #111;
  transform: scale(1.06);
}

.story-composer__stage.is-dragging .story-composer__add {
  transform: translateY(-4px) scale(1.06);
}

.story-composer__empty strong {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.story-composer__stage .story-composer__drop-hint {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.story-composer__stage .story-composer__empty small {
  max-width: 220px;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
  line-height: 1.5;
}

.story-composer__stage.has-file .story-composer__empty {
  display: none;
}

/* Caption preview and stage controls */
.story-composer__caption {
  position: absolute;
  right: 14px;
  bottom: 16px;
  left: 14px;
  z-index: 3;
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.story-composer__caption.is-set {
  opacity: 1;
  transform: none;
}

.story-composer__stage:not(.has-file) .story-composer__caption {
  display: none;
}

.story-composer__replace {
  position: absolute;
  top: 26px;
  right: 12px;
  z-index: 5;
  display: none;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(10, 10, 10, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  transition: background-color 0.2s ease;
}

.story-composer__stage.has-file .story-composer__replace {
  display: inline-flex;
}

.story-composer__stage.has-file:hover .story-composer__replace {
  background: rgba(10, 10, 10, 0.8);
}

.story-composer__done {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: #70D5AB;
  color: #0d1f17;
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
}

.story-composer__form.is-published .story-composer__done {
  opacity: 1;
  transform: none;
  transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.story-composer__form.is-uploading .story-composer__stage,
.story-composer__form.is-published .story-composer__stage {
  cursor: default;
}

.story-composer__form.is-uploading .story-composer__stage input,
.story-composer__form.is-published .story-composer__stage input {
  pointer-events: none;
}

.story-composer__form.is-uploading .story-composer__replace,
.story-composer__form.is-published .story-composer__replace {
  display: none;
}

/* ── Panel ── */
.story-composer__panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  max-height: calc(100dvh - 34px);
  padding: 22px 24px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.story-composer .story-composer__head {
  align-items: flex-start;
}

.story-composer__eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #9A9A9A;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-composer h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

.story-composer__reach {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  list-style: none;
}

.story-composer__reach li {
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 0;
  padding: 12px;
  background: #181818;
}

.story-composer__reach svg {
  color: #ECECEC;
  opacity: 0.8;
}

.story-composer__reach span {
  display: grid;
  gap: 2px;
  color: #9A9A9A;
  font-size: 11.5px;
  line-height: 1.35;
}

.story-composer__reach strong {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.story-composer__field .story-upload-modal__label {
  color: #ECECEC;
  font-size: 13px;
  font-weight: 700;
}

.story-composer__field small {
  font-variant-numeric: tabular-nums;
}

.story-composer textarea {
  min-height: 84px;
  padding: 12px 14px;
  border-color: rgba(255, 255, 255, 0.12);
  background: #111;
  font-size: 15px;
  line-height: 1.45;
  resize: none;
}

.story-composer textarea::placeholder {
  color: #7A7A7A;
}

/* Trim, restyled to the panel */
.story-composer .story-trim {
  padding: 12px;
  border-color: rgba(255, 255, 255, 0.08);
  background: #181818;
}

/* ── Contest: a two-row leaderboard. Each row fills with its likes; a
   dashed line marks the qualifying mark and is keyed in the footnote. ── */
.story-composer .story-contest {
  flex-shrink: 0;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(230, 196, 106, 0.2);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(230, 196, 106, 0.07) 0%, rgba(230, 196, 106, 0) 70%), #171614;
}

.story-composer .story-contest__head {
  gap: 12px;
}

.story-composer .story-contest__badge {
  flex-shrink: 0;
  font-size: 11px;
}

.story-composer .story-contest__clock {
  flex-shrink: 0;
  padding: 0;
  background: none;
  white-space: nowrap;
}

.story-composer .story-contest__clock strong {
  color: #fff;
  font-size: 12.5px;
}

.story-composer .story-contest__prize {
  color: #ECECEC;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.story-composer .story-contest__board {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  background: #111;
}

.story-contest__rows {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-composer .story-contest__row {
  position: relative;
  display: grid;
  grid-template-columns: 14px 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  margin: 0;
  padding: 8px 12px;
  background: none;
}

.story-composer .story-contest__row + .story-contest__row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.story-contest__bar {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 0;
  width: var(--story-row, 0%);
  min-width: 3px;
  border-right: 2px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.07));
  transform-origin: left center;
  animation: story-race 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s both;
}

.story-contest__row.is-you .story-contest__bar {
  border-right-color: #E6C46A;
  background: linear-gradient(90deg, rgba(230, 196, 106, 0.04), rgba(230, 196, 106, 0.18));
}

@keyframes story-race {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.story-contest__row > :not(.story-contest__bar) {
  position: relative;
  z-index: 1;
}

.story-contest__rank {
  color: #7A7A7A;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.story-composer .story-contest__avatar {
  display: block;
  width: 28px;
  height: 28px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  object-fit: cover;
}

.story-contest__row.is-leader .story-contest__avatar {
  border-color: #E6C46A;
}

.story-contest__row.is-open .story-contest__avatar {
  border-style: dashed;
  background: none;
}

.story-composer .story-contest__who {
  display: grid;
  gap: 1px;
  min-width: 0;
  line-height: 1.25;
}

.story-composer .story-contest__who strong {
  overflow: hidden;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-composer .story-contest__who small {
  overflow: hidden;
  color: #9A9A9A;
  font-size: 12px;
  letter-spacing: 0;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.story-composer .story-contest__row.is-you .story-contest__who strong {
  color: #E6C46A;
}

.story-composer .story-contest__row.is-you .story-contest__who small {
  color: #9A9A9A;
}

.story-contest__row.is-open .story-contest__who small {
  white-space: normal;
}

.story-composer .story-contest__likes {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.story-composer .story-contest__likes strong {
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}

.story-composer .story-contest__likes small {
  color: #9A9A9A;
  font-size: 11.5px;
}

.story-contest__line,
.story-contest__key {
  border-left: 1px dashed rgba(255, 255, 255, 0.5);
}

.story-contest__line {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  width: 0;
  pointer-events: none;
}

.story-composer .story-contest__last {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0;
  color: #9A9A9A;
  font-size: 12px;
  line-height: 1.4;
}

.story-contest__key {
  display: inline-block;
  width: 0;
  height: 12px;
  margin-right: -2px;
}

.story-contest__sep {
  color: #5A5A5A;
}

.story-contest.is-leading .story-contest__row.is-you .story-contest__rank {
  color: #E6C46A;
}

/* Stacked flex children must keep their size inside the scrolling panel. */
.story-composer__panel > *,
.story-composer__form > * {
  flex-shrink: 0;
}

/* ── Footer ── */
.story-composer__footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px 0 20px;
  background: linear-gradient(180deg, rgba(21, 21, 21, 0) 0, #151515 14px);
}

.story-composer .story-upload-modal__submit {
  position: relative;
  isolation: isolate;
  min-height: 50px;
  overflow: hidden;
  font-size: 15px;
}

.story-composer .story-upload-modal__submit::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  width: var(--story-progress, 0%);
  background: rgba(255, 255, 255, 0.16);
  transition: width 0.2s linear;
}

.story-composer__form.is-uploading .story-upload-modal__submit[disabled],
.story-composer__form.is-published .story-upload-modal__submit[disabled] {
  opacity: 1;
  background: #8f0c20;
}

.story-composer .story-upload-modal__note {
  margin: 0;
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .story-composer__stage .story-upload-modal__preview img,
  .story-composer__stage .story-upload-modal__preview video,
  .story-contest__bar {
    animation: none;
  }

  .story-upload-modal__picker.story-composer__stage,
  .story-composer__add,
  .story-composer__caption {
    transition: none;
  }
}

/* ── Mobile: full-screen composer, header, stage, details, sticky Publish ── */
@media (max-width: 760px) {
  .story-upload-modal {
    align-items: stretch;
    padding: 0;
  }

  .story-upload-modal__dialog.story-composer {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    padding: 0;
  }

  .story-composer .story-composer__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .story-composer__panel {
    display: contents;
  }

  .story-composer .story-composer__head {
    position: sticky;
    top: 0;
    z-index: 8;
    order: -1;
    align-items: center;
    margin: 0 0 -8px;
    padding: max(12px, env(safe-area-inset-top)) 16px 10px;
    background: #151515;
  }

  .story-composer__eyebrow {
    display: none;
  }

  .story-composer h2 {
    font-size: 18px;
  }

  .story-composer__stage-col {
    padding: 0 16px;
    border: 0;
    background: none;
  }

  .story-upload-modal__picker.story-composer__stage {
    height: min(60dvh, 520px);
    max-width: 100%;
  }

  .story-composer__reach,
  .story-composer .story-trim,
  .story-composer__field,
  .story-composer .story-contest {
    margin-right: 16px;
    margin-left: 16px;
  }

  .story-composer__reach li {
    gap: 6px;
    padding: 10px;
  }

  .story-composer__reach span {
    font-size: 11px;
  }

  .story-composer__reach strong {
    font-size: 12.5px;
  }

  .story-composer textarea {
    font-size: 16px;
  }

  .story-composer__footer {
    gap: 8px;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: #151515;
  }

  .story-composer .story-upload-modal__note {
    font-size: 11.5px;
  }
}

@media (max-width: 760px) and (max-height: 640px) {
  .story-upload-modal__picker.story-composer__stage {
    height: 52dvh;
  }
}
