/* © 2026 VanlifeFabrika, ALT — SPDX-License-Identifier: AGPL-3.0-or-later */
/* ALT 1.32: истории и статусы (stories.js). Цвета — токены style.css; кольца — ring.js (AltRing). */

/* ---------- лента колец над списком бесед ---------- */
.storybar { flex: none; padding: 4px 0 8px; border-bottom: 1px solid var(--border); transition: padding .2s; }
.sbrow { display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden; padding: 6px 16px 4px; /* 1.33: место для волн кольца */ scrollbar-width: none; scroll-snap-type: x proximity; }
.sbrow::-webkit-scrollbar { display: none; }
.sbi { flex: none; width: 74px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 48px; scroll-snap-align: start; border-radius: var(--r12); }
.sbi:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sbav { position: relative; width: 64px; height: 64px; display: grid; place-items: center; transition: width .2s, height .2s; }
.sbav .sring { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.sbav .sring svg { width: 100%; height: 100%; }
.avatar.sb56 { width: 54px; height: 54px; font-size: 19px; transition: width .2s, height .2s; }
.sbplus { position: absolute; right: -1px; bottom: -1px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-fill); color: var(--on-accent); display: grid; place-items: center; border: 2.5px solid var(--surface); }
.sbplus .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.sbn { max-width: 76px; font-size: 11.5px; line-height: 16px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbi.new .sbn { color: var(--text); font-weight: 600; }
.storybar.mini { padding: 2px 0 4px; }
.storybar.mini .sbav { width: 40px; height: 40px; }
.storybar.mini .avatar.sb56 { width: 33px; height: 33px; font-size: 13px; }
.storybar.mini .sbn { display: none; }
.storybar.mini .sbplus { width: 16px; height: 16px; border-width: 2px; }
.storybar.mini .sbi { width: 44px; }

/* метка пути связи на аватаре (бейдж 14) вместо точки «в сети» */
.avatar .ring-badge { right: -3px; bottom: -3px; box-shadow: 0 0 0 1.5px var(--surface); }

/* ---------- полноэкранные окна историй: поверх всего, их шторки/диалоги/подсказки — ещё выше ---------- */
.stv, .stc, .ste { position: fixed; inset: 0; z-index: 400; background: #000; color: #fff; user-select: none; -webkit-user-select: none; touch-action: none; animation: fade .15s; }
.stv ~ .overlay, .stc ~ .overlay, .ste ~ .overlay { z-index: 450; }
body:has(> .stv) #toasts, body:has(> .stc) #toasts, body:has(> .ste) #toasts { z-index: 460; }

/* ---------- просмотр ---------- */
.stv { display: flex; align-items: center; justify-content: center; gap: 16px; background: #05070c; }
.stvframe { position: relative; height: 100%; max-height: 100dvh; aspect-ratio: 9 / 16; max-width: 100vw; overflow: hidden; background: #000; }
@media (min-width: 700px) { .stvframe { height: calc(100% - 32px); border-radius: var(--r16); } }
.stvmedia { position: absolute; inset: 0; }
.stvm { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.stvov { pointer-events: none; }
.stvshade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent 18%, transparent 70%, rgba(0, 0, 0, .65)); }
.stvload { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
.stvposter { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(14px) brightness(.7); transform: scale(1.08); }
.stvwait { position: relative; width: 72px; height: 72px; }
.stvwt { position: relative; font-size: 15px; font-weight: 600; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); max-width: 260px; }
.stvbars { position: absolute; left: 8px; right: 8px; top: calc(8px + env(safe-area-inset-top)); /* 1.33: вырез экрана */ display: flex; gap: 4px; }
.stvbar { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.stvbar i { display: block; height: 100%; width: 0; background: #fff; border-radius: 2px; }
.stvhead { position: absolute; left: 8px; right: 4px; top: calc(18px + env(safe-area-inset-top)); display: flex; align-items: center; gap: 10px; min-height: 48px; }
.stvav .avatar { width: 36px; height: 36px; font-size: 14px; }
.stvwho { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 18px; }
.stvn { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.stvn b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stvwho small { font-size: 12.5px; opacity: .85; }
.stvbadge .ring-badge { position: static; display: inline-grid; background: rgba(0, 0, 0, .35); }
.stvpaused { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: var(--pill); background: rgba(0, 0, 0, .45); }
.stvbtn { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-size: 20px; }
.stvbtn .ic { width: 24px; height: 24px; }
.stvbtn:hover { background: rgba(255, 255, 255, .12); }
.stvcap { position: absolute; left: 16px; right: 16px; bottom: calc(132px + env(safe-area-inset-bottom)); font-size: 16px; line-height: 22px; text-align: center; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; }
.stvment { color: #9DBBFF; font-weight: 700; }
.stvfoot { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.stvreply { display: flex; gap: 8px; align-items: center; }
.stvin { flex: 1; min-width: 0; height: 48px; padding: 0 18px; border-radius: var(--pill); border: 1.5px solid rgba(255, 255, 255, .55); background: rgba(0, 0, 0, .3); color: #fff; font-size: 15px; outline: none; user-select: text; -webkit-user-select: text; }
.stvin::placeholder { color: rgba(255, 255, 255, .8); }
.stvin:focus { border-color: #fff; background: rgba(0, 0, 0, .5); }
.stvsend { width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--accent-fill); color: #fff; display: grid; place-items: center; }
.stvsend .ic { width: 22px; height: 22px; }
.stvreacts { display: flex; justify-content: space-between; gap: 4px; }
.stvr { flex: 1; height: 48px; font-size: 26px; border-radius: var(--r12); transition: transform .15s, background .15s; }
.stvr:hover { background: rgba(255, 255, 255, .1); }
.stvr.on { background: rgba(255, 255, 255, .2); transform: scale(1.08); }
.stvown { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.stvpill { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: var(--pill); background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; font-size: 15px; }
.stvpill .ic { width: 20px; height: 20px; }
.stvpill.danger { background: rgba(229, 72, 77, .28); }
.stvpill:hover { background: rgba(255, 255, 255, .24); }
.stvnav { width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; flex: none; }
.stvnav .ic { width: 24px; height: 24px; }
.stvnav.next .ic { transform: rotate(180deg); }
.stvnav:disabled { opacity: .3; }
@media (max-width: 699px) { .stvnav { display: none; } }
.stvburst { position: absolute; font-size: 40px; transform: translate(-50%, 0); pointer-events: none; animation: stv-burst .9s ease-out forwards; }
@keyframes stv-burst { from { opacity: 1; transform: translate(-50%, 0) scale(.8); } to { opacity: 0; transform: translate(-50%, -160px) scale(1.6); } }
.stvlist { padding: 4px 16px 12px; overflow: auto; }
.stvvrow { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.stvvrow .arm { flex: 1; display: flex; flex-direction: column; }
.stvvrow small { color: var(--muted); font-size: 13px; }
.stvve { font-size: 22px; }

/* ---------- камера 9:16 ---------- */
.stc, .ste { display: flex; flex-direction: column; background: #05070c; }
.stctop { flex: none; display: flex; align-items: center; gap: 8px; padding: 4px 8px; min-height: 56px; }
.stctop b { flex: 1; text-align: center; font-size: 17px; }
.stcbtn { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.stcbtn .ic { width: 24px; height: 24px; }
.stcbtn:hover { background: rgba(255, 255, 255, .12); }
.stcbtn:disabled { opacity: .35; }
.stcsp { width: 48px; flex: none; }
.stcframe { position: relative; flex: 1; min-height: 0; margin: 0 auto; aspect-ratio: 9 / 16; max-width: 100%; border-radius: var(--r16); overflow: hidden; background: #111; }
.stcvid { width: 100%; height: 100%; object-fit: cover; }
.stcvid.mirror { transform: scaleX(-1); }
.stcmsg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; font-size: 15px; line-height: 21px; color: rgba(255, 255, 255, .9); }
.stctime { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); padding: 4px 12px; border-radius: var(--pill); background: var(--danger-fill); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.stcbot { flex: none; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.stcmodes { display: flex; gap: 6px; }
.stc .pill, .ste .pill { min-height: 36px; padding: 0 14px; border-radius: var(--pill); background: rgba(255, 255, 255, .12); color: #fff; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.stc .pill.on, .ste .pill.on { background: #fff; color: #101A2C; }
.ste .pill.danger { background: rgba(229, 72, 77, .3); }
.stcrow { width: 100%; max-width: 420px; display: flex; align-items: center; justify-content: space-between; }
.stcgal { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; min-height: 48px; color: #fff; font-size: 12px; }
.stcgal .ic { width: 26px; height: 26px; }
.stcshot { position: relative; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; touch-action: none; }
.stcshot > i { width: 66px; height: 66px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .35); transition: transform .15s, background .15s, border-radius .15s; }
.stcshot.vid > i { background: var(--danger-fill); }
.stcshot.rec > i { transform: scale(.55); border-radius: 12px; background: var(--danger-fill); }
.stcshot:disabled { opacity: .35; }
.stcring { position: absolute; inset: 0; pointer-events: none; }

/* ---------- редактор ---------- */
.stewrap { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 56px 0 8px; }
.stestage { position: relative; border-radius: var(--r12); overflow: hidden; background: #111; touch-action: none; }
.stebase, .stedraw, .stevid { position: absolute; inset: 0; width: 100%; height: 100%; }
.stevid { object-fit: fill; }
.stedraw { z-index: 2; }
.steitems { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.ste.drawing .steitems { opacity: .85; }
.steit { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; cursor: grab; display: flex; flex-direction: column; align-items: center; line-height: 1.25; white-space: pre; text-align: center; touch-action: none; }
.ste.drawing .steit { pointer-events: none; }
.steit.sel { outline: 2px dashed rgba(255, 255, 255, .9); outline-offset: 6px; border-radius: 6px; }
.steit.stk { line-height: 1; }
.stetools { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; z-index: 5; }
.stetool { width: 52px; min-height: 52px; border-radius: var(--r12); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; background: rgba(0, 0, 0, .35); }
.stetool span { font-size: 20px; line-height: 24px; font-weight: 700; }
.stetool small { font-size: 10px; opacity: .85; }
.stetool.on { background: #fff; color: #101A2C; }
.stepanel { flex: none; padding: 8px 16px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; min-height: 8px; }
.stepanel input[type=range] { width: min(420px, 100%); accent-color: #fff; }
.stehint { margin: 0; max-width: 480px; text-align: center; font-size: 13.5px; line-height: 19px; color: rgba(255, 255, 255, .8); }
.steswatch { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stesw { width: 32px; height: 32px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); position: relative; }
.stesw::after { content: ''; position: absolute; inset: -8px; }
.stesw.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent); }
.stesizes { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.stestk { display: grid; grid-template-columns: repeat(8, 48px); gap: 4px; max-width: 100%; overflow-x: auto; }
.stestkb { width: 48px; height: 48px; font-size: 28px; border-radius: var(--r12); }
.stestkb:hover { background: rgba(255, 255, 255, .12); }
.steflt { display: flex; gap: 8px; overflow-x: auto; max-width: 100%; padding-bottom: 4px; }
.steflb { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; font-size: 12px; min-height: 48px; }
.steflb canvas { width: 54px; height: 72px; border-radius: 8px; box-shadow: 0 0 0 2px transparent; }
.steflb.on canvas { box-shadow: 0 0 0 2px #fff; }
.steflb.on small { font-weight: 700; }
.steselrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; font-size: 14px; }
.steselrow input[type=range] { width: 160px; }
.stefoot { flex: none; display: flex; justify-content: flex-end; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); }
.stenext { min-width: 140px; }
.stenext .ic { width: 20px; height: 20px; }
.stetxtov { position: absolute; inset: 0; z-index: 10; background: rgba(0, 0, 0, .65); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; }
.stetxt { width: min(520px, 100%); background: transparent; border: 0; color: #fff; font: 700 28px/1.25 Onest, Inter, system-ui, sans-serif; text-align: center; outline: none; resize: none; user-select: text; -webkit-user-select: text; }
.stetxtbtns { display: flex; gap: 12px; }
.ste .tbtn { color: #fff; min-height: 48px; padding: 0 16px; font-weight: 600; }

/* ---------- «Подпись и кому» ---------- */
.stp { display: flex; flex-direction: column; overflow: auto; padding-bottom: 8px; }
.stptop { display: flex; gap: 12px; padding: 4px 16px 0; }
.stpprev { position: relative; flex: none; width: 72px; height: 128px; border-radius: var(--r12); overflow: hidden; background: var(--surface2); }
.stpprev img { width: 100%; height: 100%; object-fit: cover; }
.stpvid { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .5); padding: 1px 6px; border-radius: var(--pill); }
.stpcap { position: relative; flex: 1; min-width: 0; }
.stptxt { width: 100%; height: 128px; resize: none; border: 1px solid var(--border); border-radius: var(--r12); background: var(--surface2); padding: 10px 12px; font-size: 15px; line-height: 21px; outline: none; }
.stptxt:focus { border-color: var(--accent); }
.stpsug { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 3; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r12); box-shadow: var(--shadow-2); padding: 4px; }
.stpsi { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 8px; border-radius: var(--r8); text-align: left; }
.stpsi:hover { background: var(--surface2); }
.stppills { display: flex; gap: 8px; padding: 0 16px; }
.stppills .pill { flex: 1; min-height: 48px; border-radius: var(--pill); border: 1.5px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.stppills .pill .ic { width: 18px; height: 18px; }
.stppills .pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.stp .stehint { color: var(--muted); padding: 8px 16px 0; text-align: left; max-width: none; }
.stpprog { margin: 12px 16px 0; height: 4px; border-radius: 2px; background: var(--surface2); overflow: hidden; }
.stpprog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.stppub { margin: 14px 16px 0; width: calc(100% - 32px); }
.stppub .ic { width: 20px; height: 20px; }

/* ---------- статус ---------- */
.sts { padding: 0 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.sts .bshead { padding-left: 0; padding-right: 0; }
.stsemo { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.stse { height: 48px; font-size: 26px; border-radius: var(--r12); }
.stse.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.stsinrow { position: relative; }
.stsin { width: 100%; height: 48px; border-radius: var(--r12); border: 1px solid var(--border); background: var(--surface2); padding: 0 56px 0 14px; font-size: 15px; outline: none; }
.stsin:focus { border-color: var(--accent); }
.stscnt { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; }
.stspre { display: flex; flex-wrap: wrap; gap: 8px; }
.stspre .pill { min-height: 40px; padding: 0 14px; border-radius: var(--pill); background: var(--surface2); font-size: 14px; font-weight: 600; }
.stsbtns { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- карточки в чате ---------- */
.strc { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; padding: 6px 10px 6px 6px; border-radius: var(--r12); background: rgba(127, 127, 127, .12); text-align: left; max-width: 280px; min-height: 48px; }
.strcth { flex: none; width: 36px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--surface3); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--accent); }
.strcth img { width: 100%; height: 100%; object-fit: cover; }
.strcno { color: var(--muted); font-size: 18px; }
.strc.gone .strcth { box-shadow: none; opacity: .7; }
.strct { display: flex; flex-direction: column; min-width: 0; line-height: 18px; }
.strct b { font-size: 13.5px; }
.strct small { font-size: 12px; opacity: .75; }
.stair { display: flex; align-items: center; gap: 10px; }
.stair.ok { cursor: pointer; }
.stairr { flex: none; width: 36px; height: 36px; }
.stairt { display: flex; flex-direction: column; min-width: 0; line-height: 19px; }
.stairt small { opacity: .75; font-size: 12.5px; }

@media (prefers-reduced-motion: reduce) {
  .stv, .stc, .ste { animation: none; }
  .stvburst { display: none; }
  .storybar, .sbav, .avatar.sb56, .stcshot > i { transition: none; }
}
