/* Stories & highlights — кружки как в приложении (ringSizes: 72 / 62 / 2) */

:root {
    --ring-outer: 4.5rem;
    --ring-inner: 3.875rem;
    --ring-stroke: 2px;
    --ring-slot: 4.875rem;
    --ring-plus-badge: 1.375rem;
    --story-ring-active: #3390ec;
    --story-ring-seen: #5a5a5e;
}

.stories-bar-wrap {
    margin-bottom: 1rem;
    overflow: hidden;
    content-visibility: auto;
    contain-intrinsic-size: auto 5.5rem;
}

.stories-sidebar-card.stories-bar-wrap {
    margin-bottom: 1.5rem;
    contain-intrinsic-size: auto 5.25rem;
}

.stories-sidebar-body {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    min-height: 6.75rem;
}

.stories-sidebar-card .stories-sidebar-body {
    padding: var(--pad-card);
    min-height: 0;
}

.stories-sidebar-card .stories-bar {
    padding: 0;
    gap: 0.375rem;
    scrollbar-width: none;
    cursor: grab;
    touch-action: pan-x;
}

.stories-sidebar-card .stories-bar::-webkit-scrollbar {
    display: none;
}

.stories-bar.is-dragging,
.profile-highlights-bar.is-dragging {
    cursor: grabbing;
    user-select: none;
    scroll-behavior: auto;
}

.stories-bar img,
.profile-highlights-bar img {
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

.stories-sidebar-card .story-ring {
    gap: 0;
}

.stories-sidebar-card .story-ring-label {
    display: none;
}

.stories-bar,
.profile-highlights-bar {
    display: flex;
    gap: 0.375rem;
    overflow-x: auto;
    padding: 0.5rem 0 0.25rem;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    cursor: grab;
    touch-action: pan-x;
}

.profile-bottom-block .profile-highlights-bar {
    padding: 0.25rem 0 0;
    margin: 0;
    content-visibility: auto;
    contain-intrinsic-size: auto 6.5rem;
    min-height: 6rem;
}

.stories-bar::-webkit-scrollbar,
.profile-highlights-bar::-webkit-scrollbar {
    display: none;
}

.story-ring,
.highlight-ring {
    flex: 0 0 var(--ring-slot);
    width: var(--ring-slot);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
}

.story-ring-slot {
    position: relative;
    width: var(--ring-slot);
    height: var(--ring-slot);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-ring-visual {
    position: relative;
    width: var(--ring-outer);
    height: var(--ring-outer);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-ring-stroke {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: var(--ring-stroke) solid var(--story-ring-seen);
    box-sizing: border-box;
    pointer-events: none;
}

.story-ring--active .story-ring-stroke {
    border-color: var(--story-ring-active);
}

.story-ring-visual--empty .story-ring-stroke {
    display: none;
}

.story-ring-avatar {
    width: var(--ring-inner);
    height: var(--ring-inner);
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-bg-tertiary, #252525);
}

.story-ring-avatar-fallback {
    display: block;
    background:
        radial-gradient(circle at 50% 38%, rgba(255,255,255,0.16) 0 22%, transparent 23%),
        radial-gradient(circle at 50% 112%, rgba(255,255,255,0.12) 0 42%, transparent 43%),
        var(--color-bg-tertiary, #252525);
}

.story-ring-plus {
    position: absolute;
    right: 0;
    bottom: 2px;
    width: var(--ring-plus-badge);
    height: var(--ring-plus-badge);
    border-radius: 50%;
    background: var(--color-accent, #f0a840);
    border: 2px solid var(--color-bg, #141414);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    z-index: 1;
}

.story-ring-plus i,
.story-ring-plus svg {
    width: 0.8125rem;
    height: 0.8125rem;
    stroke: currentColor;
}

.highlight-ring-visual {
    width: var(--ring-outer);
    height: var(--ring-outer);
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--color-border, #3d3d3d);
    background: var(--color-bg-tertiary, #252525);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    color: var(--color-text-secondary);
}

.highlight-ring--add .highlight-ring-visual i,
.highlight-ring--add .highlight-ring-visual svg {
    width: 1.5rem;
    height: 1.5rem;
    stroke: currentColor;
}

.highlight-ring-visual img,
.highlight-ring-visual video.highlight-ring-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: none;
    border-radius: 0;
    background: var(--color-bg-tertiary, #252525);
}

.story-ring-label:empty {
    display: none;
}

.story-ring-label,
.highlight-ring-label {
    font-size: 0.75rem;
    line-height: 1.2;
    max-width: var(--ring-slot);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-secondary);
    text-align: center;
}

/* Story viewer */
body.story-viewer-open {
    overflow: hidden;
}

.story-viewer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    color: #fff;
}

.story-viewer[hidden] {
    display: none !important;
}

.story-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.story-viewer-layout {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    width: 100%;
    height: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
    --story-viewer-max-h: min(1080px, calc(100vh - 1rem));
    --story-viewer-max-w: min(680px, calc(var(--story-viewer-max-h) * 9 / 16));
}

.story-viewer-rail {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.875rem;
    max-height: var(--story-viewer-max-h, min(1080px, calc(100vh - 1rem)));
    overflow-y: auto;
    padding: 0.25rem 0;
    scrollbar-width: none;
}

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

.story-viewer-rail[hidden] {
    display: none !important;
}

.story-viewer-rail-item {
    flex: 0 0 auto;
    width: 3.25rem;
    height: 3.25rem;
    padding: 0;
    border: none;
    border-radius: var(--radius-full);
    background: none;
    cursor: pointer;
    position: relative;
    opacity: 0.72;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.story-viewer-rail-item:hover {
    opacity: 0.92;
}

.story-viewer-rail-item.is-active {
    opacity: 1;
    transform: scale(1.06);
}

.story-viewer-rail-item img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
    display: block;
}

.story-viewer-rail-ring {
    position: absolute;
    inset: -3px;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    pointer-events: none;
}

.story-viewer-rail-item.is-unseen .story-viewer-rail-ring {
    border-color: var(--color-primary);
}

.story-viewer-rail-item.is-active .story-viewer-rail-ring {
    border-color: #fff;
}

.story-viewer-stage {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-width: 0;
    max-width: 100%;
}

.story-viewer-arrow {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.story-viewer-arrow:hover {
    background: rgba(255, 255, 255, 0.22);
}

.story-viewer-arrow[hidden] {
    display: none !important;
}

.story-viewer-arrow i,
.story-viewer-arrow svg {
    width: 1.35rem;
    height: 1.35rem;
}

.story-viewer-card {
    position: relative;
    flex: 0 1 auto;
    height: var(--story-viewer-max-h);
    width: var(--story-viewer-max-w);
    max-height: var(--story-viewer-max-h);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
}

.story-viewer-progress {
    position: absolute;
    top: 0.625rem;
    left: 0.625rem;
    right: 0.625rem;
    display: flex;
    gap: 4px;
    z-index: 4;
}

.story-progress-seg {
    position: relative;
    flex: 1;
    height: 2px;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.35);
    overflow: hidden;
}

.story-progress-seg.is-done {
    background: #fff;
}

.story-progress-seg.is-active {
    background: rgba(255, 255, 255, 0.35);
}

.story-progress-seg.is-active::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff;
    transform: scaleX(var(--story-progress, 0));
    transform-origin: left center;
    border-radius: inherit;
}

.story-viewer-top {
    position: absolute;
    top: 1.75rem;
    left: 0.625rem;
    right: 0.625rem;
    z-index: 4;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    pointer-events: none;
}

.story-viewer-top > * {
    pointer-events: auto;
}

.story-viewer-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.story-viewer-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}

.story-viewer-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.1rem;
}

.story-viewer-name {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-viewer-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.2;
}

.story-viewer-top-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.story-viewer-close,
.story-viewer-pause {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-viewer-close:hover,
.story-viewer-pause:hover {
    background: rgba(255, 255, 255, 0.12);
}

.story-viewer-close i,
.story-viewer-close svg,
.story-viewer-pause i,
.story-viewer-pause svg {
    width: 1.15rem;
    height: 1.15rem;
}

.story-viewer-media {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    background: #000;
}

.story-viewer-media img,
.story-viewer-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.story-viewer-caption {
    position: absolute;
    left: 0.875rem;
    right: 0.875rem;
    bottom: 3.75rem;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.4;
    text-align: left;
    color: #fff;
    pointer-events: auto;
    white-space: pre-wrap;
}

.story-viewer-caption .post-text-bold { font-weight: 500; }
.story-viewer-caption .post-text-italic { font-style: italic; }
.story-viewer-caption .post-text-underline { text-decoration: underline; }
.story-viewer-caption .post-text-strikethrough { text-decoration: line-through; }
.story-viewer-caption .post-text-code {
    font-family: var(--font-family-mono);
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.35);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}
.story-viewer-caption .post-text-spoiler {
    background: rgba(255, 255, 255, 0.45);
    color: rgba(255, 255, 255, 0.45);
    border-radius: 3px;
    padding: 0 3px;
    cursor: pointer;
}
.story-viewer-caption .post-text-spoiler:hover,
.story-viewer-caption .post-text-spoiler.spoiler-revealed {
    background: transparent;
    color: inherit;
}

.story-viewer-card:has(.story-viewer-reply:not([hidden])) .story-viewer-caption {
    bottom: 5.25rem;
}

.story-viewer-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    padding: 1rem 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.625rem;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.45) 100%);
    pointer-events: none;
}

.story-viewer-footer > * {
    pointer-events: auto;
}

.story-viewer-reply {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.story-viewer-reply[hidden] {
    display: none !important;
}

.story-viewer-reply-input {
    flex: 1;
    min-width: 0;
    height: 2.5rem;
    padding: 0 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.28);
    color: #fff;
    font: inherit;
    font-size: 0.875rem;
}

.story-viewer-reply-input::placeholder {
    color: rgba(255, 255, 255, 0.62);
}

.story-viewer-reply-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
}

.story-viewer-reply-send {
    flex: 0 0 auto;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-viewer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
    position: relative;
    z-index: 5;
    flex-shrink: 0;
}

.story-viewer-like,
.story-viewer-likes-stat,
.story-viewer-share,
.story-viewer-views {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.25rem;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.story-viewer-like.is-liked {
    color: #ff3b5c;
}

.story-viewer-likes-stat.is-active {
    color: var(--color-primary);
}

.story-viewer-likes-stat.is-active i,
.story-viewer-likes-stat.is-active svg {
    fill: var(--color-primary);
}

.story-viewer-like i,
.story-viewer-like svg,
.story-viewer-likes-stat i,
.story-viewer-likes-stat svg,
.story-viewer-share i,
.story-viewer-share svg,
.story-viewer-views i,
.story-viewer-views svg {
    width: 1.15rem;
    height: 1.15rem;
}

.story-viewer-likes-stat span,
.story-viewer-views span {
    font-size: 0.8125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.story-viewer-nav {
    position: absolute;
    top: 3.5rem;
    bottom: 5rem;
    width: 38%;
    z-index: 2;
}

.story-viewer-nav--prev { left: 0; }
.story-viewer-nav--next { right: 0; }

@media (max-width: 768px) {
    .story-viewer-layout {
        padding: 0;
        gap: 0;
    }

    .story-viewer-rail,
    .story-viewer-arrow {
        display: none !important;
    }

    .story-viewer-stage {
        width: 100%;
        height: 100%;
        gap: 0;
    }

    .story-viewer-card {
        width: 100%;
        max-width: none;
        max-height: none;
        height: 100%;
        aspect-ratio: auto;
        border-radius: 0;
        box-shadow: none;
    }

    .story-viewer-backdrop {
        background: #000;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* Мобильный бар историй: без карточки.
   Горизонталь уже даёт .container (--container-padding) — сюда не дублируем.
   Только лёгкий вертикальный зазор у ряда кружков. */
@media (max-width: 768px) {
    .stories-sidebar-card.stories-bar-wrap,
    .sidebar-card.stories-sidebar-card {
        margin: 0;
        background: transparent;
        border: none;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
        contain-intrinsic-size: auto 5.75rem;
    }

    .stories-sidebar-card .stories-sidebar-body,
    .stories-sidebar-card .card-body {
        padding: 0.45rem 0 0.35rem;
        min-height: 0;
        background: transparent;
    }

    .stories-sidebar-card .stories-bar {
        padding: 0;
        gap: 0.375rem;
    }

    .stories-sidebar-card .story-ring {
        gap: 0.2rem;
    }

    .stories-sidebar-card .story-ring-label {
        display: block;
        font-size: 0.6875rem;
        line-height: 1.15;
        max-width: 100%;
    }
}

.story-viewers-sheet {
    position: fixed;
    inset: 0;
    z-index: 1250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.story-viewers-sheet[hidden] {
    display: none !important;
}

.story-viewers-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.story-viewers-panel {
    position: relative;
    width: 100%;
    max-width: min(100%, 20rem);
    max-height: min(70vh, 24rem);
    overflow: auto;
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2.25rem 0 0.5rem;
    box-shadow: var(--shadow-xl);
}

.story-viewers-grabber {
    display: none;
}

.story-viewers-close {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    z-index: 1;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-viewers-close:hover {
    color: var(--color-text-secondary);
    background: var(--color-surface-hover);
}

.story-viewers-list {
    list-style: none;
    margin: 0;
    padding: 0 0.25rem 0.5rem;
}

.story-viewers-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.25rem;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0;
}

.story-viewers-person {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.45rem 0.5rem;
    border-radius: var(--radius-md);
    color: inherit;
    text-decoration: none;
}

.story-viewers-person:hover {
    background: var(--color-surface-hover);
}

.story-viewers-person img,
.story-viewers-avatar-fallback {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.story-viewers-person img {
    object-fit: cover;
}

.story-viewers-avatar-fallback {
    display: block;
    background: var(--color-bg-tertiary);
}

.story-viewers-name {
    font-size: 0.9375rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-viewers-like {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 1.75rem;
    justify-self: end;
    color: #ff3b5c;
}

.story-viewers-like--empty {
    visibility: hidden;
    pointer-events: none;
}

.story-viewers-like i,
.story-viewers-like svg {
    width: 1.125rem;
    height: 1.125rem;
    fill: currentColor;
}

/* Create sheet — диалог по центру (как «Создать пост»), не bottom sheet */
.create-sheet {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.create-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.create-sheet-panel {
    position: relative;
    width: 100%;
    max-width: 20rem;
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0.375rem 0;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.create-sheet-item,
.create-sheet-cancel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: none;
    background: none;
    font: inherit;
    font-size: 1rem;
    color: var(--color-text-primary);
    cursor: pointer;
    text-align: left;
}

.create-sheet-item svg {
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.create-sheet-item:hover,
.create-sheet-cancel:hover {
    background: var(--color-surface-hover);
}

.create-sheet-cancel {
    justify-content: center;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
}

/* SR modals (story / highlight) — как create-post-modal */
.sr-modal {
    position: fixed;
    inset: 0;
    z-index: 1150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.sr-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.sr-modal-box {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow: auto;
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.sr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--pad-block, 1rem);
    border-bottom: 1px solid var(--color-border);
}

.sr-modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.sr-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.sr-modal-close:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
}

.sr-modal-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sr-form-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sr-form-row .form-label {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    margin: 0;
}

.sr-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 10rem;
    padding: 1rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    background: var(--color-bg-secondary);
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.sr-upload-zone:hover {
    border-color: var(--color-primary);
    background: var(--color-bg-primary);
}

.sr-upload-zone.has-preview {
    border-style: solid;
    min-height: auto;
    padding: 0.625rem;
}

.sr-upload-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sr-upload-placeholder[hidden] {
    display: none !important;
}

.sr-upload-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: var(--radius-full);
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.sr-upload-zone:hover .sr-upload-icon {
    color: var(--color-primary);
    border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border));
    background: color-mix(in srgb, var(--color-primary) 8%, var(--color-bg-primary));
}

.sr-upload-icon svg,
.sr-upload-icon i {
    width: 1.5rem;
    height: 1.5rem;
}

.sr-upload-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.sr-upload-preview:empty {
    display: none;
}

.sr-upload-zone img,
.sr-upload-zone video {
    display: block;
    max-width: 100%;
    max-height: 12rem;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.sr-upload-hint {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.sr-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.sr-upload-progress {
    height: 3px;
    margin: 0;
    background: var(--color-border-light, rgba(0, 0, 0, 0.08));
    border-radius: 2px;
    overflow: hidden;
}

.sr-upload-progress.hidden {
    display: none;
}

.sr-upload-progress-bar {
    display: block;
    height: 100%;
    width: 0;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 0.12s ease-out;
}

/* Profile avatar story ring — как StoryAvatarRing в приложении */
.profile-avatar-wrap--stories {
    width: calc(var(--profile-avatar-size, 100px) + 8px);
    height: calc(var(--profile-avatar-size, 100px) + 8px);
    min-height: 0;
    padding: 0;
    border-radius: var(--radius-full);
    background: none;
    box-sizing: border-box;
}

.profile-avatar-wrap--stories::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: var(--ring-stroke) solid var(--story-ring-seen);
    box-sizing: border-box;
    pointer-events: none;
    z-index: 2;
}

.profile-avatar-wrap--stories-unseen::before {
    border-color: var(--story-ring-active);
}

.profile-avatar-wrap--stories .profile-avatar {
    width: var(--profile-avatar-size, 100px);
    height: var(--profile-avatar-size, 100px);
    padding: 0;
    background: var(--color-bg-tertiary, #252525);
    border: none;
    box-sizing: border-box;
    box-shadow: none;
}

.profile-avatar-wrap--stories .profile-avatar img {
    border: none;
    box-sizing: border-box;
}

.profile-avatar--stories.profile-avatar--clickable {
    cursor: pointer;
}

.highlight-ring-wrap {
    position: relative;
    flex: 0 0 auto;
}

.highlight-ring-fallback {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--color-bg-tertiary, #252525);
}

/* Highlight menu */
.highlight-menu-sheet {
    position: fixed;
    inset: 0;
    z-index: 1160;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.highlight-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.highlight-menu-panel {
    position: relative;
    width: 100%;
    max-width: 18rem;
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.highlight-menu-item {
    display: block;
    width: 100%;
    padding: 0.875rem 1rem;
    border: none;
    background: none;
    font: inherit;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    color: var(--color-text-primary);
}

.highlight-menu-item:hover {
    background: var(--color-surface-hover);
}

.highlight-menu-item--danger {
    color: var(--color-primary);
}

.highlight-menu-item--cancel {
    text-align: center;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
}

.highlight-menu-item[hidden] {
    display: none !important;
}

.highlight-reorder-panel {
    position: relative;
    width: 100%;
    max-width: 22rem;
    max-height: min(80vh, 32rem);
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.highlight-reorder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.highlight-reorder-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.highlight-reorder-done {
    border: none;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
}

.highlight-reorder-list {
    list-style: none;
    margin: 0;
    padding: 0.35rem 0;
    overflow: auto;
}

.highlight-reorder-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
}

.highlight-reorder-thumb {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-bg-tertiary, #252525);
}

.highlight-reorder-thumb img,
.highlight-reorder-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.highlight-reorder-name {
    flex: 1;
    min-width: 0;
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.highlight-reorder-moves {
    display: inline-flex;
    gap: 0.2rem;
    flex-shrink: 0;
}

.highlight-reorder-move {
    width: 1.75rem;
    height: 1.75rem;
    border: none;
    border-radius: var(--radius-full);
    background: var(--color-bg-secondary, #1d1d1d);
    color: var(--color-text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.highlight-reorder-move:disabled {
    opacity: 0.35;
    cursor: default;
}

.highlight-reorder-move svg,
.highlight-reorder-move i {
    width: 1rem;
    height: 1rem;
}


/* Highlights viewer page (профиль) */
.highlights-page .main-layout {
    padding-bottom: 0;
}

.highlights-page {
    background: #000;
}

.highlights-viewer {
    height: calc(100dvh - var(--header-height, 56px));
    max-width: 32rem;
    margin: 0 auto;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
}

.highlights-viewer::-webkit-scrollbar {
    display: none;
}

.highlights-viewer-track {
    display: flex;
    flex-direction: column;
}

.highlights-page-item {
    position: relative;
    flex: 0 0 auto;
    height: calc(100dvh - var(--header-height, 56px));
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: #000;
    overflow: hidden;
}

.highlights-page-poster,
.highlights-page-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.highlights-page-poster {
    pointer-events: none;
}

.highlights-page-video {
    background: #000;
}

.highlights-page-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    pointer-events: none;
}

.highlights-page-meta {
    padding: 1rem 1.25rem 1.25rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    pointer-events: auto;
}

.highlights-page-author {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.highlights-page-caption {
    margin: 0.35rem 0 0;
    color: #fff;
    font-size: 0.875rem;
    line-height: 1.35;
}

.highlights-page-sentinel {
    height: 1px;
    scroll-snap-align: end;
}

@media (max-width: 768px) {
    .create-sheet-panel {
        max-width: min(100%, 20rem);
    }

    .story-viewers-panel {
        max-height: min(80vh, 28rem);
    }
}
