/* Penweet Stories — strip, composer, viewer */

:root {
    --story-accent: var(--lilk, #7C3AED);
    --story-accent-hover: var(--Hlilk, #8b5fe4);
    --story-accent-deep: #6d28d9;
    --story-accent-soft: rgba(124, 58, 237, 0.12);
    --story-pink: var(--pink, #ED3AAB);
    --story-ink: #212121;
    --story-muted: #6b7280;
    --story-ring: linear-gradient(135deg, var(--story-accent) 0%, #9b6ef5 48%, var(--story-pink) 100%);
    --story-ring-idle: #e8e8ee;
    --story-surface: #fafafa;
    --story-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── Rail / strip (Facebook flow, circular + Penweet colors) ─── */

.story-rail {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.7rem 0.2rem 0.35rem;
    margin: 0 0.75rem 0.55rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.story-rail::-webkit-scrollbar {
    display: none;
}

.story-rail__item {
    flex: 0 0 auto;
    width: 78px;
    scroll-snap-align: start;
    text-align: center;
    text-decoration: none;
    color: inherit;
    background: none;
    border: 0;
    padding: 0 0 0.15rem;
    cursor: pointer;
    appearance: none;
}

.story-rail__ring {
    position: relative;
    width: 70px;
    height: 70px;
    margin: 0 auto;
    padding: 3px;
    border-radius: 50%;
    background: var(--story-ring-idle);
    transition: transform 0.22s var(--story-ease), box-shadow 0.22s ease;
}

.story-rail__item--live .story-rail__ring,
.story-rail__item--mine.has-story .story-rail__ring {
    background: var(--story-ring);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.22);
}

.story-rail__item--live.is-seen .story-rail__ring {
    background: #d1d5db;
    box-shadow: none;
}

.story-rail__item--create .story-rail__ring,
.story-rail__item--empty .story-rail__ring {
    background:
        linear-gradient(#fff, #fff) padding-box,
        linear-gradient(145deg, rgba(124, 58, 237, 0.45), rgba(237, 58, 171, 0.35)) border-box;
    border: 2px solid transparent;
    padding: 2px;
    box-shadow: none;
}

.story-rail__item:hover .story-rail__ring,
.story-rail__item:focus-visible .story-rail__ring {
    transform: translateY(-2px) scale(1.03);
}

.story-rail__item--live:hover .story-rail__ring,
.story-rail__item--mine.has-story:hover .story-rail__ring {
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
}

.story-rail__item--create:hover .story-rail__ring {
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.16);
}

.story-rail__item:focus-visible {
    outline: none;
}

.story-rail__item:focus-visible .story-rail__ring {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
}

.story-rail__media {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: #f0f0f5;
    box-shadow: inset 0 0 0 2.5px #fff;
}

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

.story-rail__media--empty,
.story-rail__media--create {
    background:
        radial-gradient(120% 100% at 30% 20%, rgba(124, 58, 237, 0.14), transparent 58%),
        linear-gradient(160deg, #f7f5ff 0%, #efeafc 100%);
}

.story-rail__item--create .story-rail__add {
    bottom: -1px;
    inset-inline-end: -1px;
}

.story-rail__avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-rail__play,
.story-rail__badge {
    display: none;
}

.story-rail__add {
    position: absolute;
    bottom: 0;
    inset-inline-end: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    background: var(--story-ring);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 3;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.35);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.story-rail__item--create:hover .story-rail__add,
.story-rail__add:hover {
    transform: scale(1.08);
    filter: brightness(1.05);
    color: #fff;
}

.story-rail__add i {
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    margin-top: 0.5px;
}

.story-rail__label {
    margin: 0.45rem 0 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--story-ink);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 78px;
    margin-inline: auto;
}

.story-rail__item--create .story-rail__label {
    color: var(--story-accent-deep);
}

.story-rail__item--mine.has-story .story-rail__label,
.story-rail__item--live .story-rail__label {
    color: var(--story-ink);
}

/* ─── Upload picker modal ─── */

.story-upload-modal .modal-dialog {
    max-width: 440px;
}

.story-upload-modal .modal-content {
    border: 0 !important;
    border-radius: 28px;
    overflow: hidden;
    padding: 0;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(124, 58, 237, 0.14), transparent 52%),
        radial-gradient(100% 70% at 100% 100%, rgba(237, 58, 171, 0.1), transparent 48%),
        #fff;
    box-shadow: 0 30px 90px rgba(20, 20, 31, 0.2);
}

.story-upload-modal__body {
    padding: 2.4rem 1.7rem 1.9rem;
    text-align: center;
}

.story-upload-modal__icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 1.2rem;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 32px;
    background: var(--story-ring);
    box-shadow: 0 16px 34px rgba(124, 58, 237, 0.3);
    animation: story-float 3.2s var(--story-ease) infinite;
}

.story-upload-modal__title {
    font-size: clamp(1.3rem, 2.6vw, 1.55rem);
    font-weight: 750;
    letter-spacing: -0.02em;
    color: var(--story-ink);
    margin: 0 0 0.45rem;
}

.story-upload-modal__text {
    color: var(--story-muted);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0 0 0.35rem;
}

.story-upload-modal__drop-hint {
    margin: 0 0 1rem;
    color: var(--story-accent);
    font-size: 0.82rem;
    font-weight: 600;
}

.story-upload-modal__body.is-dragover {
    outline: 2px dashed var(--story-accent);
    outline-offset: -10px;
    border-radius: 22px;
    background: rgba(124, 58, 237, 0.06);
}

.story-upload-modal__panel {
    margin: 0 0 1.35rem;
    padding: 0.9rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(124, 58, 237, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    text-align: start;
}

.story-upload-modal__hint {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.75rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: var(--story-accent-soft);
    color: var(--story-accent);
    font-size: 0.76rem;
    font-weight: 650;
    line-height: 1.3;
}

.story-upload-modal__specs {
    display: grid;
    gap: 0.55rem;
}

.story-upload-modal__spec {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.75rem;
    border-radius: 14px;
    background: #f7f5ff;
    border: 1px solid rgba(124, 58, 237, 0.08);
}

.story-upload-modal__spec-icon {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.95rem;
    background: var(--story-ring);
}

.story-upload-modal__spec-copy {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.story-upload-modal__spec-copy strong {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--story-ink);
}

.story-upload-modal__spec-copy span {
    font-size: 0.76rem;
    line-height: 1.4;
    color: var(--story-muted);
}

.story-upload-modal__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    min-height: 50px;
    padding: 0.7rem 1.5rem;
    border-radius: 999px;
    border: 0;
    background: var(--story-accent);
    color: #fff !important;
    font-weight: 650;
    font-size: 0.98rem;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.3);
    transition: transform 0.2s var(--story-ease), background 0.2s ease, box-shadow 0.2s ease;
}

.story-upload-modal__cta:hover {
    background: var(--story-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(124, 58, 237, 0.36);
    color: #fff !important;
}

.story-upload-modal .btn-close {
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
    z-index: 2;
    opacity: 0.55;
}

.story-upload-modal .btn-close:hover {
    opacity: 0.9;
}

/* ─── Contrast composer ─── */

.story-composer-modal .modal-dialog {
    max-width: 400px;
}

.story-composer-modal .modal-content {
    border: 0 !important;
    border-radius: 26px;
    overflow: hidden;
    background: #0c0c12;
    color: #fff;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
    padding: 0;
    height: auto;
    max-height: min(92vh, 760px);
    display: flex;
    flex-direction: column;
}

.story-composer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent);
}

.story-composer__user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.story-composer__avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.story-composer__identity {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.08rem;
}

.story-composer__name {
    font-weight: 650;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-composer__subtitle {
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.01em;
}

.story-composer__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 320px;
    height: min(48vh, 420px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 0.65rem 1rem 0.25rem;
    background:
        radial-gradient(80% 60% at 50% 40%, rgba(124, 58, 237, 0.12), transparent 70%),
        #09090f;
    overflow: hidden;
}

.story-composer__frame {
    position: relative;
    width: min(100%, calc((min(48vh, 420px) - 3.5rem) * 9 / 16));
    aspect-ratio: 9 / 16;
    max-height: calc(100% - 2.2rem);
    border-radius: 18px;
    overflow: hidden;
    background: #050508;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 18px 40px rgba(0, 0, 0, 0.35);
    cursor: default;
    touch-action: none;
}

.story-composer__frame.is-pannable {
    cursor: grab;
}

.story-composer__frame.is-pannable:active {
    cursor: grabbing;
}

.story-composer__vignette {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0%, transparent 18%, transparent 72%, rgba(0, 0, 0, 0.42) 100%);
}

.story-composer__stage .preview-media {
    display: none;
    user-select: none;
    -webkit-user-drag: none;
    background: #050508;
    pointer-events: none;
}

.story-composer__stage img.preview-media {
    position: absolute;
    left: 0;
    top: 0;
    max-width: none;
    object-fit: fill;
    will-change: transform;
    transform-origin: 0 0;
}

.story-composer__stage video.preview-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: auto;
    object-fit: contain;
    background: #000;
    pointer-events: auto;
}

.story-composer__zoom {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.45rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.story-composer__zoom-btn {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transition: background 0.15s ease;
}

.story-composer__zoom-btn:hover:not(:disabled) {
    background: rgba(124, 58, 237, 0.35);
}

.story-composer__zoom-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.story-composer__zoom-btn:focus-visible,
.story-composer__chip:focus-visible,
.story-composer__tool:focus-visible,
.story-composer__actions .btn:focus-visible {
    outline: 2px solid rgba(167, 139, 250, 0.9);
    outline-offset: 2px;
}

.story-composer__zoom-range {
    flex: 1 1 auto;
    min-width: 0;
    accent-color: #7c3aed;
}

.story-composer__zoom-label {
    min-width: 3.1rem;
    text-align: end;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.story-composer__caption {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 14%;
    z-index: 2;
    margin: 0;
    text-align: center;
    color: #fff;
    font-weight: 700;
    font-size: clamp(0.95rem, 3.4vw, 1.15rem);
    line-height: 1.25;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
    pointer-events: none;
    word-break: break-word;
}

.story-composer__meta {
    margin: 0;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.75rem;
    font-weight: 600;
}

.story-composer__controls {
    padding: 0.75rem 1rem 1.05rem;
    background: linear-gradient(0deg, #12121a 0%, #161622 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.story-composer__tools {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.story-composer__filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.1rem;
    scrollbar-width: none;
}

.story-composer__filters::-webkit-scrollbar {
    display: none;
}

.story-composer__chip {
    border: 0;
    border-radius: 999px;
    min-height: 32px;
    padding: 0.3rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
    transition: background 0.15s ease, color 0.15s ease;
}

.story-composer__chip.is-active,
.story-composer__chip:hover {
    background: rgba(124, 58, 237, 0.35);
    color: #fff;
}

.story-composer__caption-row {
    position: relative;
}

.story-composer__caption-input {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    border-radius: 12px;
    padding-block: 0.55rem;
    padding-inline: 0.75rem 3.4rem;
    font-size: 0.9rem;
}

.story-composer__caption-input:focus {
    outline: none;
    border-color: rgba(124, 58, 237, 0.55);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}

.story-composer__caption-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.story-composer__caption-count {
    position: absolute;
    inset-inline-end: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    font-weight: 650;
    color: rgba(255, 255, 255, 0.4);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.story-composer__caption-count.is-near-limit {
    color: #fbbf24;
}

.story-composer__video-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.story-composer__tool {
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.82rem;
    width: fit-content;
    transition: background 0.15s ease;
}

.story-composer__tool:hover {
    background: rgba(255, 255, 255, 0.14);
}

.story-composer__trim {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.story-composer__trim label {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
    margin: 0;
}

.story-composer__trim input[type="range"] {
    width: 100%;
    accent-color: #7c3aed;
}

.story-composer__progress {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.story-composer__progress-track {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.25);
    overflow: hidden;
}

#storyUploadProgressBar {
    display: block;
    background: linear-gradient(90deg, var(--story-accent), #a855f7);
    height: 6px;
    border-radius: 999px;
    width: 0;
    transition: width 0.15s linear;
}

#storyUploadProgressText {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
}

.story-composer__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.story-composer__actions-end {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-inline-start: auto;
}

.story-composer__actions .btn {
    min-height: 42px;
    padding: 0.45rem 1.15rem;
    font-weight: 600;
}

.story-composer__actions .btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 0;
}

.story-composer__actions .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.story-composer__actions .post-btn {
    background: var(--story-accent);
    color: #fff;
    border: 0;
    min-width: 96px;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
}

.story-composer__actions .post-btn:hover:not(:disabled) {
    background: var(--story-accent-hover);
    color: #fff;
}

.story-composer__actions .post-btn:disabled,
.story-composer__actions .btn-ghost:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

#storyComposerRoot.is-busy .story-composer__tools,
#storyComposerRoot.is-busy .story-composer__frame {
    pointer-events: none;
    opacity: 0.72;
}

/* ─── Viewer ─── */

.story-viewer-modal {
    --bs-modal-bg: transparent;
}

.story-viewer-modal .modal-dialog {
    max-width: 420px;
    margin: 0.75rem auto;
}

.story-viewer-modal .modal-content {
    background: transparent;
    border: 0;
    box-shadow: none;
}

.story-viewer {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: min(92vh, 760px);
    margin: 0 auto;
    border-radius: 22px;
    overflow: hidden;
    background: #050508;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.story-viewer__progress {
    position: absolute;
    top: 0.7rem;
    inset-inline: 0.7rem;
    z-index: 35;
    display: flex;
    gap: 4px;
}

.story-viewer__seg {
    flex: 1;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
    overflow: hidden;
}

.story-viewer__seg-fill {
    height: 100%;
    width: 100%;
    background: #fff;
    border-radius: inherit;
    transform: scaleX(0);
    transform-origin: left center;
    will-change: transform;
}

[dir="rtl"] .story-viewer__seg-fill {
    transform-origin: right center;
}

.story-viewer__seg.is-done .story-viewer__seg-fill {
    transform: scaleX(1);
    transition: none;
}

.story-viewer__header {
    position: absolute;
    top: 1.15rem;
    inset-inline: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem 1.5rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.62) 0%, transparent 100%);
}

.story-viewer__avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.45);
    flex-shrink: 0;
}

.story-viewer__meta {
    min-width: 0;
    flex: 1;
}

.story-viewer__owner-line {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin: 0;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 650;
}

.story-viewer__owner-line #sv-expires {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.65);
}

.story-viewer__follow {
    margin: 0.1rem 0 0;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 650;
    cursor: pointer;
    opacity: 0.92;
    transition: opacity 0.15s ease;
}

.story-viewer__follow:hover {
    opacity: 1;
    text-decoration: underline;
}

.story-viewer__close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.story-viewer__close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.story-viewer__frame {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.story-viewer__frame .story-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 28;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.story-viewer:hover .story-viewer__nav,
.story-viewer__nav:focus-visible {
    opacity: 1;
}

.story-viewer__nav:hover {
    background: rgba(0, 0, 0, 0.55);
}

.story-viewer__nav--prev {
    inset-inline-start: 0.65rem;
}

.story-viewer__nav--next {
    inset-inline-end: 0.65rem;
}

.story-viewer__tap {
    position: absolute;
    top: 4.5rem;
    bottom: 5.5rem;
    width: 42%;
    z-index: 20;
    background: transparent;
    border: 0;
    padding: 0;
}

.story-viewer__tap--prev {
    inset-inline-start: 0;
}

.story-viewer__tap--next {
    inset-inline-end: 0;
}

.story-viewer__footer {
    position: absolute;
    bottom: 0;
    inset-inline: 0;
    z-index: 30;
    padding: 2.5rem 0.9rem 1rem;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.72) 0%, transparent 100%);
}

.story-viewer__compose {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
}

.story-viewer__mute {
    position: absolute;
    inset-inline-end: 0.75rem;
    bottom: 0.75rem;
    z-index: 5;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.story-viewer__send {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: var(--story-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.story-viewer__send:hover {
    background: var(--story-accent-hover);
    color: #fff;
}

.story-viewer__owner-actions {
    width: 100%;
    display: flex;
    justify-content: center;
}

.story-viewer__delete {
    min-height: 42px;
    border: 0;
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
    font-size: 0.88rem;
}

.story-viewer__delete:hover {
    background: rgba(239, 68, 68, 0.85);
}

.story-viewer__react.is-liked {
    background: rgba(237, 58, 171, 0.28);
    color: #ed3aab;
    border-color: rgba(237, 58, 171, 0.4);
}

.story-viewer__react.is-liked:hover {
    background: rgba(237, 58, 171, 0.38);
    color: #ed3aab;
}

.story-viewer__react {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 0;
    background: var(--story-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 10px 22px rgba(124, 58, 237, 0.4);
    transition: transform 0.18s var(--story-ease), background 0.18s ease;
}

.story-viewer__react:hover {
    background: var(--story-accent-hover);
    color: #fff;
    transform: scale(1.06);
}

.story-viewer__react:active {
    transform: scale(0.94);
}

.story-viewer__input {
    flex: 1;
    min-height: 46px;
    border-radius: 999px !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    padding: 0.55rem 1rem !important;
    backdrop-filter: blur(10px);
    box-shadow: none !important;
}

.story-viewer__input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.story-viewer__input:focus {
    border-color: rgba(124, 58, 237, 0.65) !important;
    background: rgba(255, 255, 255, 0.14) !important;
}

/* Dimmer around viewer */
#storyViewerModal.modal {
    background: rgba(5, 5, 10, 0.78) !important;
    backdrop-filter: blur(6px);
}

/* ─── Standalone create page ─── */

.story-create-page {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(70% 50% at 15% 10%, rgba(124, 58, 237, 0.12), transparent 55%),
        radial-gradient(60% 45% at 90% 90%, rgba(237, 58, 171, 0.08), transparent 50%),
        #fafafa;
}

.story-create-card {
    width: 100%;
    max-width: 460px;
    border: 0;
    border-radius: 24px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 24px 60px rgba(20, 20, 31, 0.1);
}

.story-create-card__head {
    padding: 1.6rem 1.5rem 1rem;
    text-align: center;
    background:
        radial-gradient(100% 120% at 50% 0%, rgba(124, 58, 237, 0.14), transparent 70%);
}

.story-create-card__head h1 {
    font-size: 1.35rem;
    font-weight: 750;
    margin: 0 0 0.4rem;
    color: var(--story-ink);
}

.story-create-card__head p {
    margin: 0;
    color: var(--story-muted);
    font-size: 0.92rem;
}

.story-create-card__body {
    padding: 0.5rem 1.5rem 1.5rem;
}

.story-create-drop {
    border: 2px dashed rgba(124, 58, 237, 0.35);
    border-radius: 18px;
    background: linear-gradient(180deg, #fbfaff, #f5f2ff);
    padding: 1.5rem 1rem;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.story-create-drop:hover {
    border-color: var(--story-accent);
    background: #f3eeff;
}

.story-create-drop .form-control {
    border: 0;
    background: transparent;
    box-shadow: none;
}

.story-create-actions .btn-primary {
    background: var(--story-accent);
    border-color: var(--story-accent);
}

.story-create-actions .btn-primary:hover {
    background: var(--story-accent-hover);
    border-color: var(--story-accent-hover);
}

@keyframes story-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@media (max-width: 575.98px) {
    .story-rail {
        margin: 0 !important;
        padding: 10px 16px 8px !important;
        gap: 0.75rem;
    }

    .story-rail__item {
        width: 72px;
    }

    .story-rail__ring {
        width: 64px;
        height: 64px;
    }

    .story-rail__label {
        max-width: 72px;
        font-size: 10.5px;
    }

    .story-rail__add {
        width: 22px;
        height: 22px;
    }

    .story-viewer {
        border-radius: 0;
        max-height: 100vh;
        aspect-ratio: auto;
        height: 100dvh;
    }

    .story-viewer-modal .modal-dialog {
        max-width: 100%;
        margin: 0;
        height: 100%;
    }

    .story-viewer-modal .modal-content {
        height: 100%;
        border-radius: 0;
    }

    .story-viewer__nav {
        opacity: 0.55;
    }

    .story-composer__stage {
        min-height: 280px;
        height: 42vh;
    }
}

@media (prefers-reduced-motion: reduce) {
    .story-rail__item:hover .story-rail__ring,
    .story-rail__media img,
    .story-upload-modal__icon,
    .story-upload-modal__cta {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}
