/* ---------- Admin ---------- */

.story-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1rem;
}

.story-card__title { font-size: 1.05rem; font-weight: 700; margin: 0 0 .5rem; }
.story-card__text { color: #555; font-size: .9rem; margin-bottom: .75rem; }

.story-form[hidden],
.story-field[hidden],
#storyFormError[hidden],
#storyEmpty[hidden] { display: none; }

.story-field { display: block; margin-bottom: .9rem; }
.story-field > span { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.story-field > span em { font-weight: 400; color: #777; font-style: normal; }
.story-field small { display: block; color: #777; margin-top: .25rem; }
.story-field input[type="text"],
.story-field select,
.story-field textarea,
.story-field input[type="file"] {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: .6rem;
    padding: .5rem .7rem;
    font-size: .95rem;
    background: #fff;
}

.story-form__actions { display: flex; justify-content: flex-end; gap: .5rem; }

.story-list { display: flex; flex-direction: column; gap: .75rem; }

.story-item {
    position: relative;
    display: flex;
    gap: .9rem;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 1rem;
    padding: .75rem;
}

.story-item--expired { opacity: .65; }

.story-item__image {
    width: 72px;
    aspect-ratio: 9 / 16;
    object-fit: cover;
    border-radius: .6rem;
    background: #f1f1f1;
    flex: none;
}

.story-item__body { min-width: 0; flex: 1; padding-right: 1.75rem; }
.story-item__status { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #e1306c; }
.story-item--expired .story-item__status { color: #888; }
.story-item__caption { font-weight: 600; overflow-wrap: anywhere; margin: .15rem 0; }
.story-item__link { font-size: .8rem; color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-item__stats { display: flex; gap: 1.25rem; margin-top: .5rem; }
.story-item__stats div { display: flex; flex-direction: column; line-height: 1.15; }
.story-item__stats strong { font-size: 1.05rem; }
.story-item__stats span { font-size: .7rem; color: #777; }

.story-item__delete {
    position: absolute;
    top: .5rem;
    right: .5rem;
    border: 0;
    background: transparent;
    color: #888;
    padding: .35rem;
    border-radius: 50%;
}

.story-item__delete:hover { color: #d00; background: #fceaea; }

/* ---------- Profile: ring and viewer ---------- */

.story-avatar--live {
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px #e1306c;
}

.story-avatar--seen { box-shadow: 0 0 0 3px #fff, 0 0 0 6px #bbb; }

/* Avatars that already sit in their own padded ring (Instagram and OnlyFans layouts) recolour it instead of adding a second one. */
.story-avatar--live.story-avatar--ringed {
    box-shadow: none;
    background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7);
}

.story-avatar--live.story-avatar--ringed.story-avatar--seen { background: #c7c7c7; }

.story-avatar--live:focus-visible { outline: 3px solid #0d6efd; outline-offset: 8px; }

.story-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: .75rem auto;
    padding: .4rem .9rem;
    border: 0;
    border-radius: 999px;
    background: #e1306c;
    color: #fff;
    font-weight: 600;
    font-size: .85rem;
}

.story-pill--seen { background: #999; }

.story-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, .92);
}

.story-viewer__frame {
    position: relative;
    width: min(100vw, calc(100dvh * 9 / 16));
    height: min(100dvh, calc(100vw * 16 / 9));
    background: #000;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

.story-viewer__image { width: 100%; height: 100%; object-fit: contain; display: block; }

.story-viewer__bars {
    position: absolute;
    top: .6rem;
    left: .6rem;
    right: .6rem;
    display: flex;
    gap: .25rem;
    z-index: 2;
}

.story-viewer__bar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.story-viewer__bar > i { display: block; height: 100%; width: 0; background: #fff; }
.story-viewer__bar--done > i { width: 100%; }

.story-viewer__close {
    position: absolute;
    top: 1.1rem;
    right: .6rem;
    z-index: 3;
    border: 0;
    background: rgba(0, 0, 0, .35);
    color: #fff;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    font-size: 1rem;
}

.story-viewer__tap { position: absolute; top: 3rem; bottom: 7rem; width: 40%; z-index: 1; background: transparent; border: 0; }
.story-viewer__tap--prev { left: 0; }
.story-viewer__tap--next { right: 0; width: 60%; }

.story-viewer__footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 3rem 1rem 1.25rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, .75));
    color: #fff;
    text-align: center;
}

.story-viewer__caption { margin: 0 0 .75rem; font-size: 1rem; overflow-wrap: anywhere; }

.story-viewer__cta {
    display: inline-block;
    max-width: 100%;
    padding: .6rem 1.5rem;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-weight: 700;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-viewer__cta:hover { color: #111; background: #f1f1f1; }

body.story-viewer-open { overflow: hidden; }

.story-viewer__who {
    position: absolute;
    top: 1.1rem;
    left: .75rem;
    right: 3.5rem;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.story-viewer__who[hidden],
.story-viewer__who img[hidden] { display: none; }

.story-viewer__who img { width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover; }
.story-viewer__who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Feed: story tray ---------- */

.story-tray {
    display: flex;
    gap: .85rem;
    width: 100%;
    padding: .75rem .75rem .5rem;
    margin-bottom: .5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.story-tray[hidden] { display: none; }
.story-tray::-webkit-scrollbar { display: none; }

.story-bubble {
    position: relative;
    flex: none;
    width: 72px;
    text-align: center;
}

.story-bubble__main {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-decoration: none;
}

.story-bubble__main:hover { color: inherit; }

.story-bubble__ring {
    display: block;
    width: 68px;
    height: 68px;
    margin: 0 auto .3rem;
    padding: 3px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f9ce34, #ee2a7b, #6228d7);
}

.story-bubble--seen .story-bubble__ring { background: #c7c7c7; }

/* Your own bubble with nothing live has no ring, just the + */
.story-bubble--empty .story-bubble__ring { background: transparent; }

.story-bubble__add {
    position: absolute;
    top: 46px;
    left: calc(50% + 10px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #0095f6;
    color: #fff;
    font-size: .7rem;
    text-decoration: none;
}

a.story-bubble__add:hover { color: #fff; background: #0081d6; }

.story-bubble__avatar {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
    background: #efefef;
}

.story-bubble__avatar--initial {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.4rem;
    color: #555;
}

.story-bubble__label {
    display: block;
    font-size: .72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-bubble:focus-visible { outline: 2px solid #0d6efd; outline-offset: 2px; border-radius: .5rem; }
