/* ===== Barra de stories (círculos) ===== */
.stories-wrap {
    margin: 0 auto 1.25rem;
    max-width: 640px;
}

.stories-bar {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.stories-bar::-webkit-scrollbar { display: none; }

.story-circle {
    flex: 0 0 auto;
    width: 72px;
    background: none;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: inherit;
}

.story-ring {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    padding: 3px;
    display: grid;
    place-items: center;
    background: linear-gradient(45deg, #f9ce34, #ee2a7b 45%, #6228d7);
    transition: transform .12s ease;
}
.story-circle:active .story-ring { transform: scale(.94); }

/* Já visto: anel apagado (cinza). */
.story-circle.seen .story-ring {
    background: var(--gym-border, #30363d);
}

.story-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gym-bg, #0d1117);
    background: var(--gym-surface, #161b22);
}

.story-name {
    font-size: .68rem;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #c9d1d9;
}

/* Tile "Seu story" (＋). */
.story-add { position: relative; }
.story-ring-add { background: var(--gym-border, #30363d); }
.story-plus {
    position: absolute;
    top: 42px;
    left: 50%;
    transform: translateX(2px);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gym-accent, #2ea043);
    color: #fff;
    font-weight: 700;
    font-size: .95rem;
    line-height: 20px;
    border: 2px solid var(--gym-bg, #0d1117);
    display: grid;
    place-items: center;
}

/* ===== Viewer (tela cheia) ===== */
.story-viewer {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    opacity: 0;
    visibility: hidden;      /* fechado não intercepta cliques/scroll */
    pointer-events: none;
    transition: opacity .18s ease, visibility .18s ease;
}
.story-viewer.open { opacity: 1; visibility: visible; pointer-events: auto; }

.sv-stage {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px;
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sv-media {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Barras de progresso no topo */
.sv-bars {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 5;
}
.sv-bar {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background: rgba(255,255,255,.35);
    overflow: hidden;
}
.sv-bar > i {
    display: block;
    height: 100%;
    width: 0;
    background: #fff;
    border-radius: 3px;
}
.sv-bar.done > i { width: 100%; }

/* Cabeçalho do viewer */
.sv-head {
    position: absolute;
    top: 20px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 5;
    color: #fff;
}
.sv-head img {
    width: 34px; height: 34px; border-radius: 50%;
    object-fit: cover; border: 1px solid rgba(255,255,255,.5);
}
.sv-head .sv-who { font-weight: 600; font-size: .9rem; }
.sv-head .sv-ago { font-size: .75rem; opacity: .8; }
.sv-actions { margin-left: auto; display: flex; gap: 6px; }
.sv-btn {
    background: rgba(0,0,0,.35);
    border: none;
    color: #fff;
    font-size: 1.15rem;
    line-height: 1;
    width: 38px; height: 38px;
    border-radius: 50%;
    cursor: pointer;
}

/* Zonas de toque (voltar / avançar) */
.sv-nav { position: absolute; top: 0; bottom: 0; width: 33%; z-index: 4; }
.sv-nav.prev { left: 0; }
.sv-nav.next { right: 0; }

.sv-loading {
    position: absolute;
    z-index: 3;
    color: #fff;
    font-size: .9rem;
    opacity: .8;
}

/* ===== Composer (criar story) ===== */
.story-composer {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: #000;
    display: flex;
    flex-direction: column;
    color: #fff;
}
.sc-stage {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
/* Moldura 9:16 central (letterbox), sempre inteira na tela; mídia e overlays dentro dela. */
.sc-frame {
    position: relative;
    aspect-ratio: 9 / 16;
    width: 56.25vh;              /* fallback: 100vh * 9/16 */
    width: min(100%, calc(100dvh * 9 / 16));
    max-width: 100%;
    height: auto;
    margin: auto;
    overflow: hidden;
}
.sc-media { position: absolute; inset: 0; }
.sc-video, .sc-canvas, .sc-preview {
    position: absolute; inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
/* Prévia ao vivo/canvas em "cover" (aproxima o recorte 9:16 que será gravado). */
.sc-video, .sc-canvas { object-fit: cover; }
.sc-video { transform: scaleX(-1); } /* espelha a câmera frontal (só preview) */
.sc-hidden { display: none !important; }

/* Camada de overlays (texto/figurinhas) sobre a mídia. */
.sc-overlays { position: absolute; inset: 0; z-index: 3; }
.sc-ov {
    position: absolute; transform: translate(-50%, -50%);
    cursor: move; touch-action: none; user-select: none;
    line-height: 1.1; white-space: pre-wrap; text-align: center;
    max-width: 90%;
}
.sc-ov-text { font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.sc-ov.sel { outline: 1px dashed rgba(255,255,255,.8); outline-offset: 4px; }
.sc-ov-del {
    display: none;
    position: absolute; top: -14px; right: -14px;
    width: 24px; height: 24px; border-radius: 50%;
    background: #ee2a7b; color: #fff; border: 2px solid #fff;
    font-size: .7rem; line-height: 1; cursor: pointer; padding: 0;
    place-items: center;
}
.sc-ov.sel .sc-ov-del { display: grid; }

.sc-top {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; z-index: 5;
    background: linear-gradient(to bottom, rgba(0,0,0,.5), transparent);
}
.sc-top button {
    background: rgba(0,0,0,.4); border: none; color: #fff;
    font-size: 1.1rem; width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
}
.sc-boomerang.active { background: var(--gym-accent, #2ea043); }

.sc-bottom {
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    display: flex; align-items: center; justify-content: center; gap: 26px;
    background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 5;
}
.sc-gallery, .sc-flip {
    background: rgba(0,0,0,.4); border: none; color: #fff;
    font-size: 1.4rem; width: 50px; height: 50px; border-radius: 50%; cursor: pointer;
}
.sc-shutter {
    width: 74px; height: 74px; border-radius: 50%;
    border: 5px solid #fff; background: rgba(255,255,255,.25);
    cursor: pointer; position: relative; flex: 0 0 auto;
    transition: transform .1s ease;
}
.sc-shutter.recording { border-color: #ee2a7b; }
.sc-shutter.recording::after {
    content: ""; position: absolute; inset: 22px;
    background: #ee2a7b; border-radius: 6px;
}
.sc-hint {
    position: absolute; bottom: 108px; left: 0; right: 0; text-align: center;
    font-size: .78rem; opacity: .85; z-index: 5;
}
.sc-timer {
    position: absolute; top: 62px; left: 50%; transform: translateX(-50%);
    background: #ee2a7b; color: #fff; font-weight: 700; font-size: .8rem;
    padding: 3px 10px; border-radius: 20px; z-index: 6;
}

/* Barra de ações da prévia (antes de publicar) */
.sc-review {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 6;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    display: flex; gap: 12px; justify-content: space-between;
    background: linear-gradient(to top, rgba(0,0,0,.6), transparent);
}
.sc-review .btn { flex: 1; }

.sc-busy {
    position: absolute; inset: 0; z-index: 10;
    background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: .95rem; gap: 10px;
}

/* Ferramentas de edição (coluna à direita, na revisão) */
.sc-tools {
    position: absolute; top: 60px; right: 12px; z-index: 6;
    display: flex; flex-direction: column; gap: 10px;
}
.sc-tool {
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(0,0,0,.45); border: none; color: #fff;
    font-size: 1.1rem; font-weight: 700; cursor: pointer;
}
.sc-size {
    position: absolute; bottom: 92px; left: 16px; right: 16px; z-index: 6;
    accent-color: var(--gym-accent, #2ea043);
}

/* Bottom-sheets (música/texto/figurinha/filtro) */
.sc-sheet {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 8;
    background: #12161c; border-top: 1px solid var(--gym-border, #30363d);
    border-radius: 16px 16px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
    max-height: 62%; overflow-y: auto;
}
.sc-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sc-sheet-head button { background: none; border: none; color: #fff; font-size: 1.1rem; cursor: pointer; }
.sc-empty { color: #9aa6b2; font-size: .9rem; padding: 8px 0; }

/* Lista de faixas */
.sc-track { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; cursor: pointer; }
.sc-track.sel { background: rgba(46,160,67,.18); outline: 1px solid var(--gym-accent, #2ea043); }
.sc-track-play {
    width: 38px; height: 38px; border-radius: 50%; flex: none;
    background: var(--gym-surface-2, #21262d); border: none; color: #fff; cursor: pointer;
}
.sc-track-info b { display: block; font-size: .92rem; }
.sc-track-info small { color: #9aa6b2; }
.sc-track-start { margin: 10px 2px; }
.sc-track-start input { width: 100%; accent-color: var(--gym-accent, #2ea043); }
.sc-music-none { margin-top: 8px; }

/* Editor de texto */
.sc-text-input { width: 100%; background: var(--gym-surface, #161b22); color: #fff;
    border: 1px solid var(--gym-border, #30363d); border-radius: 10px; padding: 8px; }
.sc-color-row { display: flex; gap: 8px; margin: 10px 0; }
.sc-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.sc-color.sel { border-color: #fff; }

/* Figurinhas / filtros */
.sc-sticker-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.sc-sticker-pick { background: none; border: none; font-size: 1.6rem; cursor: pointer; padding: 4px; }
.sc-filter-row { display: flex; gap: 10px; overflow-x: auto; }
.sc-filter-pick {
    flex: 0 0 auto; padding: 8px 14px; border-radius: 20px; cursor: pointer;
    background: var(--gym-surface-2, #21262d); border: 1px solid var(--gym-border, #30363d); color: #fff;
}
.sc-filter-pick.sel { background: var(--gym-accent, #2ea043); border-color: var(--gym-accent, #2ea043); }

/* ===== Viewer: música, rodapé (reações/resposta), quem viu ===== */
.sv-music {
    display: flex; align-items: center; gap: 4px;
    font-size: .75rem; color: #fff; background: rgba(0,0,0,.35);
    padding: 3px 8px; border-radius: 20px; max-width: 120px;
}
.sv-music span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sv-foot {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
}
.sv-reply { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sv-reply-input {
    flex: 1 1 60%; min-width: 0; background: rgba(255,255,255,.12); color: #fff;
    border: 1px solid rgba(255,255,255,.35); border-radius: 22px; padding: 8px 14px;
}
.sv-reply-input::placeholder { color: rgba(255,255,255,.7); }
.sv-reply-send { background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; }
.sv-reacts { display: flex; gap: 4px; width: 100%; justify-content: space-between; margin-top: 8px; }
.sv-react { background: none; border: none; font-size: 1.5rem; cursor: pointer; transition: transform .1s; }
.sv-react:active { transform: scale(1.4); }

.sv-viewers-btn {
    background: rgba(0,0,0,.4); border: none; color: #fff; cursor: pointer;
    border-radius: 20px; padding: 8px 16px; font-size: .9rem;
}

.sv-viewers-panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 9;
    background: #12161c; border-top: 1px solid var(--gym-border, #30363d);
    border-radius: 16px 16px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
    max-height: 55%; overflow-y: auto;
}
.sv-vp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sv-vp-head button { background: none; border: none; color: #fff; font-size: 1.1rem; cursor: pointer; }
.sv-vp-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.sv-vp-row img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.sv-vp-row span { flex: 1; }
.sv-vp-row small { color: #9aa6b2; }
.sv-vp-empty { color: #9aa6b2; text-align: center; padding: 16px; }
