/* ═══ Истории и фото профиля (stories.js) ═══ */
html.st-open, html.st-open body { overflow: hidden; }

/* кольцо вокруг аватарки: наш градиент — есть новая история, серое — просмотрено */
.st-ring { --sz: 58px; position: relative; display: inline-grid; place-items: center; width: var(--sz); height: var(--sz); border-radius: 50%; padding: 3px; flex: none; }
.st-ring.new { background: conic-gradient(from 210deg, #fb923c, #ea580c, #2563eb, #60a5fa, #fb923c); animation: stSpin 6s linear infinite; }
.st-ring.seen { background: #cbd5e1; }
.st-ring.none { padding: 0; }
.st-ring.sm { --sz: 34px; padding: 2px; }
.st-ring.none.sm { padding: 0; }
.st-ava { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: hsl(var(--h, 210) 70% 52%); color: #fff; font: 800 .95rem var(--font-display, system-ui); border: 2.5px solid #fff; animation: stUnspin 6s linear infinite paused; }
.st-ring.new .st-ava { animation-play-state: running; }
.st-ring.none .st-ava { border: 0; }
.st-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes stSpin { to { transform: rotate(360deg); } }
@keyframes stUnspin { to { transform: rotate(-360deg); } }

/* кольцо на аватарках мессенджера (квадратные со скруглением — кольцо повторяет форму) */
.msg-ava[data-ava] { cursor: pointer; }
.msg-ava.st-new, .msg-ava.st-seen { box-sizing: border-box; border: 2.5px solid transparent; padding: 2px; }
.msg-ava.st-new { background: linear-gradient(hsl(var(--h, 210) 70% 52%), hsl(var(--h, 210) 70% 52%)) content-box, linear-gradient(#fff, #fff) padding-box, conic-gradient(from 210deg, #fb923c, #ea580c, #2563eb, #60a5fa, #fb923c) border-box !important; }
.msg-ava.st-seen { background: linear-gradient(hsl(var(--h, 210) 70% 52%), hsl(var(--h, 210) 70% 52%)) content-box, linear-gradient(#fff, #fff) padding-box, linear-gradient(#cbd5e1, #cbd5e1) border-box !important; }
.msg-ava.st-new img, .msg-ava.st-seen img { border-radius: inherit; border-radius: 10px; }
.msg-m .msg-ava.st-new img, .msg-m .msg-ava.st-seen img { border-radius: 6px; }

/* полоса историй */
.st-bar { display: flex; gap: 12px; overflow-x: auto; padding: 10px 14px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.st-bar::-webkit-scrollbar { display: none; }
.st-chip { position: relative; display: grid; justify-items: center; gap: 4px; width: 64px; flex: none; padding: 0; border: 0; background: none; cursor: pointer; font: 600 .7rem var(--font-body, system-ui); color: #334155; }
.st-chip small { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-chip--add i { position: absolute; top: 38px; left: 40px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 900 .9rem/1 system-ui; font-style: normal; color: #fff; background: linear-gradient(135deg, #fb923c, #ea580c); border: 2.5px solid #fff; }
.st-chip--add .st-ring { --sz: 58px; }
.st-chip:active .st-ring { transform: scale(.94); }

/* фото профиля */
.st-photo { position: fixed; inset: 0; z-index: 14000; display: grid; place-items: center; padding: 24px; background: rgba(8, 20, 60, .9); background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(37, 99, 235, .55), transparent 70%), linear-gradient(170deg, rgba(23, 50, 140, .94), rgba(6, 14, 44, .97)); opacity: 0; transition: opacity .2s; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.st-photo.on { opacity: 1; }
.st-photo figure { margin: 0; display: grid; gap: 12px; justify-items: center; transform: scale(.94); transition: transform .22s; }
.st-photo.on figure { transform: none; }
.st-photo img { max-width: min(92vw, 640px); max-height: 78vh; border-radius: 22px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.7); object-fit: contain; }
.st-photo figcaption { color: #fff; font: 800 1.05rem var(--font-display, system-ui); }
.st-x { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 14px; background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.28); color: #fff; cursor: pointer; z-index: 2; }
.st-x:hover { background: rgba(255,255,255,.24); }
.st-x svg { display: block; pointer-events: none; }

/* просмотр */
.st-view { position: fixed; inset: 0; z-index: 14000; display: grid; place-items: center; background: #020617; opacity: 0; transition: opacity .2s; touch-action: none; user-select: none; -webkit-user-select: none; }
.st-view.on { opacity: 1; }
.st-stage { position: relative; width: min(100vw, calc(100dvh * 9 / 16), 480px); aspect-ratio: 9 / 16; max-height: 100dvh; overflow: hidden; background: #0f172a; transition: transform .15s; }
@media (min-width: 700px) { .st-stage { border-radius: 18px; } }
.st-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.st-bars { position: absolute; top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; z-index: 3; display: flex; gap: 4px; }
.st-bars i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
.st-bars i b { display: block; height: 100%; width: 0; background: #fff; }
.st-bars i.done b { width: 100%; }
.st-head { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 10px; right: 6px; z-index: 3; display: flex; align-items: center; gap: 8px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.st-head b { font: 700 .9rem var(--font-body, system-ui); }
.st-head time { font: 500 .78rem var(--font-body, system-ui); opacity: .8; }
.st-sp { flex: 1; }
.st-ic { width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(15,23,42,.25); color: #fff; font: 700 1.05rem/1 system-ui; cursor: pointer; }
.st-ic[data-v="close"], .st-ic[data-e="close"] { font-size: 1.7rem; font-weight: 400; }
.st-nav { position: absolute; top: 70px; bottom: 90px; z-index: 2; width: 35%; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.st-nav--l { left: 0; } .st-nav--r { right: 0; width: 65%; }
.st-load { position: absolute; inset: 0; display: none; place-items: center; z-index: 1; }
.st-view.is-loading .st-load { display: grid; }
.st-load i, .st-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fb923c; animation: stSpin .8s linear infinite; }
.st-spin { margin: 30px auto; border-color: rgba(100,116,139,.25); border-top-color: #f97316; }
.st-foot { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 10px; background: linear-gradient(transparent, rgba(2,6,23,.55)); }
.st-reacts { display: flex; gap: 6px; padding: 6px 8px; border-radius: 999px; background: rgba(15,23,42,.45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.st-reacts button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; font-size: 1.6rem; cursor: pointer; transition: transform .15s; }
.st-reacts button:hover { transform: scale(1.15); }
.st-reacts button.pop { transform: scale(1.45); }
.st-who, .st-del { border: 0; border-radius: 999px; padding: 11px 16px; font: 700 .86rem var(--font-body, system-ui); color: #fff; background: rgba(15,23,42,.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); cursor: pointer; }
.st-fly { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.st-fly span { position: absolute; bottom: 80px; font-size: 2.4rem; animation: stFly 1.6s ease-out forwards; }
@keyframes stFly { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--dx), -420px) scale(1.3); opacity: 0; } }
.st-view.is-paused .st-head, .st-view.is-paused .st-bars { opacity: .5; }
.st-who-list { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; max-height: 62%; display: flex; flex-direction: column; border-radius: 20px 20px 0 0; background: #fff; color: #0f172a; animation: stUp .22s ease; }
@keyframes stUp { from { transform: translateY(40px); opacity: 0; } }
.st-who-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; font: 800 1rem var(--font-display, system-ui); }
.st-who-h button { border: 0; background: #f1f5f9; width: 34px; height: 34px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; }
.st-who-b { overflow-y: auto; padding: 0 12px calc(12px + env(safe-area-inset-bottom)); }
.st-who-r { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid #f1f5f9; }
.st-who-r span { flex: 1; display: grid; } .st-who-r b { font: 700 .88rem var(--font-body, system-ui); } .st-who-r small { color: #64748b; font-size: .75rem; }
.st-who-r em { font-style: normal; font-size: 1.15rem; letter-spacing: 1px; }
.st-muted { color: #64748b; text-align: center; padding: 18px 0; font: 500 .88rem var(--font-body, system-ui); }

/* редактор */
.st-ed { position: fixed; inset: 0; z-index: 14000; display: grid; place-items: center; background: #020617; opacity: 0; transition: opacity .2s; touch-action: none; user-select: none; -webkit-user-select: none; }
.st-ed.on { opacity: 1; }
.st-ed-stage { position: relative; overflow: hidden; background: #0f172a; touch-action: none; }
@media (min-width: 700px) { .st-ed-stage { border-radius: 18px; } }
.st-ed-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-ed-layer { position: absolute; left: 0; top: 0; width: 1080px; height: 1920px; transform-origin: 0 0; pointer-events: none; }
.st-item { position: absolute; left: 0; top: 0; pointer-events: auto; cursor: grab; display: flex; flex-direction: column; align-items: center; transform-origin: center; will-change: transform; }
.st-item.is-drag { cursor: grabbing; }
.st-tl { display: inline-block; padding: 0 .28em; border-radius: .22em; white-space: pre; text-align: center; }
.st-tl--none { text-shadow: 0 3px 14px rgba(0,0,0,.35); }
.st-emo { font-size: 150px; line-height: 1; }
.st-item--sticker img { width: 360px; height: 360px; display: block; pointer-events: none; }
.st-ed-start { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; color: #fff; background: radial-gradient(circle at 30% 20%, rgba(249,115,22,.35), transparent 55%), radial-gradient(circle at 70% 80%, rgba(37,99,235,.4), transparent 55%), #0f172a; }
.st-ed-start b { font: 900 1.5rem var(--font-display, system-ui); }
.st-ed-start p { margin: 0 0 8px; opacity: .8; font: 500 .9rem/1.45 var(--font-body, system-ui); max-width: 280px; }
.st-ed.is-started .st-ed-start { display: none; }
.st-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 200px; border: 0; border-radius: 14px; padding: 13px 18px; font: 800 .92rem var(--font-body, system-ui); color: #0f172a; background: #fff; cursor: pointer; }
.st-btn--ok { color: #fff; background: linear-gradient(135deg, #fb923c, #ea580c); box-shadow: 0 10px 24px -10px rgba(234,88,12,.9); }
.st-btn:disabled { opacity: .6; }
.st-ed-top { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 3; display: flex; align-items: center; gap: 6px; max-width: 540px; margin: 0 auto; }
.st-tool { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(15,23,42,.45); color: #fff; font: 800 1.1rem/1 var(--font-display, system-ui); cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.st-ed:not(.is-started) .st-tool, .st-ed:not(.is-started) .st-ed-bottom { visibility: hidden; }
.st-ed-filters { position: fixed; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 3; display: flex; gap: 8px; justify-content: center; overflow-x: auto; padding: 0 10px; scrollbar-width: none; }
.st-flt { display: grid; justify-items: center; gap: 3px; border: 0; padding: 0; background: none; color: #fff; font: 700 .68rem var(--font-body, system-ui); cursor: pointer; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.st-flt img { width: 54px; height: 54px; object-fit: cover; border-radius: 12px; border: 2px solid transparent; }
.st-flt.on img { border-color: #fb923c; box-shadow: 0 0 0 2px rgba(251,146,60,.35); }
.st-ed-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 540px; margin: 0 auto; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
.st-hint { color: rgba(255,255,255,.7); font: 600 .72rem/1.3 var(--font-body, system-ui); text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.st-pub { min-width: 0; }
.st-ed.is-dragging .st-ed-top, .st-ed.is-dragging .st-ed-bottom, .st-ed.is-dragging .st-ed-filters { opacity: 0; pointer-events: none; }
.st-trash { position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%) scale(.8); width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 1.6rem; background: rgba(15,23,42,.55); border: 2px solid rgba(255,255,255,.6); opacity: 0; transition: .15s; pointer-events: none; z-index: 2; }
.st-ed.is-dragging .st-trash { opacity: 1; }
.st-ed.trash-on .st-trash { transform: translateX(-50%) scale(1.15); background: #ef4444; border-color: #fff; }
.st-ed.trash-on .st-item.is-drag { opacity: .45; }
.st-ed.is-sheet .st-ed-top, .st-ed.is-sheet .st-ed-bottom, .st-ed.is-sheet .st-ed-filters { opacity: 0; pointer-events: none; }
.st-ed-sheet { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(2,6,23,.45); touch-action: auto; }
.st-tx { display: grid; gap: 10px; width: min(100%, 540px); margin: 0 auto; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: rgba(15,23,42,.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.st-tx textarea { width: 100%; min-height: 88px; resize: none; border: 0; border-radius: 14px; padding: 12px; background: rgba(255,255,255,.08); color: #fff; text-align: center; outline: none; user-select: text; -webkit-user-select: text; }
.st-tx-fonts { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.st-tx-fonts button { flex: none; border: 1.5px solid rgba(255,255,255,.25); border-radius: 999px; padding: 7px 13px; background: none; color: #fff; cursor: pointer; }
.st-tx-fonts button.on { background: #fff; color: #0f172a; border-color: #fff; }
.st-tx-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.st-tx-colors { display: flex; gap: 7px; flex-wrap: wrap; }
.st-tx-colors button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); background: var(--c); cursor: pointer; }
.st-tx-colors button.on { transform: scale(1.18); border-color: #fb923c; border-width: 3px; }
.st-tx-box { width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.4); background: none; color: #fff; font: 900 1.05rem var(--font-display, system-ui); cursor: pointer; }
.st-tx-box[data-mode="solid"] { background: #fff; color: #0f172a; }
.st-tx-box[data-mode="soft"] { background: rgba(255,255,255,.25); }
.st-tx-size { display: flex; align-items: center; gap: 8px; color: #cbd5e1; font: 600 .78rem var(--font-body, system-ui); }
.st-tx-size input { width: 140px; accent-color: #f97316; }
.st-tx .st-btn { min-width: 0; }
.st-pick { width: min(100%, 540px); margin: 0 auto; height: min(62vh, 520px); display: flex; flex-direction: column; gap: 10px; padding: 14px 12px 0; border-radius: 20px 20px 0 0; background: #fff; }
.st-pick-q { border: 0; border-radius: 12px; padding: 11px 14px; background: #f1f5f9; font: 500 .92rem var(--font-body, system-ui); outline: none; user-select: text; -webkit-user-select: text; }
.st-pick-g { flex: 1; overflow-y: auto; display: grid; gap: 4px; align-content: start; padding-bottom: calc(12px + env(safe-area-inset-bottom)); touch-action: pan-y; }
.st-pick-g--emo { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
.st-pick-g--emo button { height: 44px; border: 0; border-radius: 10px; background: none; font-size: 1.7rem; cursor: pointer; }
.st-pick-g--stk { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.st-pick-g--stk button { border: 0; border-radius: 14px; background: #f8fafc; padding: 6px; cursor: pointer; }
.st-pick-g--stk img { width: 100%; aspect-ratio: 1; display: block; }
.st-pick-g button:hover { background: #f1f5f9; }
.st-ed-sheet[hidden], .st-ed-filters[hidden], .st-bar[hidden] { display: none !important; }
.st-photo-a { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.st-photo-a button { border: 0; border-radius: 999px; padding: 11px 18px; font: 800 .9rem var(--font-body, system-ui); color: #fff; background: linear-gradient(135deg, #fb923c, #ea580c); cursor: pointer; box-shadow: 0 10px 24px -10px rgba(234,88,12,.9); }
.st-photo-a button + button { background: rgba(255,255,255,.16); box-shadow: none; }

/* ═══ v2: истории в наших цветах — синий клуба и оранжевый мяча, крупнее текст ═══ */
.st-view, .st-ed { background: radial-gradient(circle at 12% 0%, rgba(249, 115, 22, .38), transparent 46%), radial-gradient(circle at 100% 100%, rgba(59, 130, 246, .45), transparent 50%), linear-gradient(165deg, #1e3a8a, #172554 55%, #0f172a); }
.st-stage, .st-ed-stage { box-shadow: 0 30px 80px -30px rgba(2, 6, 23, .8), 0 0 0 1px rgba(255, 255, 255, .08); }
@media (max-width: 699px) { .st-stage, .st-ed-stage { border-radius: 18px; } }
.st-ic, .st-tool { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22); box-shadow: 0 6px 18px -8px rgba(2, 6, 23, .6); }
.st-tool { font-size: 1.15rem; }
.st-tool[data-e="text"] { background: linear-gradient(135deg, #fb923c, #ea580c); border-color: transparent; }
.st-ed-top { top: calc(12px + env(safe-area-inset-top)); }
.st-head b { font-size: 1rem; }
.st-head time { font-size: .84rem; }
.st-hint { font-size: .8rem; color: rgba(255, 255, 255, .85); }
.st-flt { font-size: .74rem; }
.st-flt img { width: 58px; height: 58px; border-radius: 14px; border-width: 2.5px; }
.st-flt.on img { border-color: #fb923c; box-shadow: 0 0 0 3px rgba(251, 146, 60, .35); }
/* окно надписи — в цветах клуба */
.st-tx { background: linear-gradient(165deg, #1e40af, #172554); box-shadow: 0 -20px 50px -20px rgba(2, 6, 23, .7); }
.st-tx textarea { font-size: 1.25rem !important; min-height: 96px; background: rgba(255, 255, 255, .1); }
.st-tx-fonts button { padding: 9px 16px; font-size: 1rem; border-color: rgba(255, 255, 255, .3); }
.st-tx-fonts button.on { background: linear-gradient(135deg, #fb923c, #ea580c); color: #fff; border-color: transparent; }
.st-tx-colors button { width: 32px; height: 32px; }
.st-tx-size { font-size: .9rem; color: #dbeafe; }
.st-pick { background: #fff; }
.st-pick-q { font-size: 1rem; }
.st-ed-start { background: radial-gradient(circle at 25% 15%, rgba(249, 115, 22, .45), transparent 55%), radial-gradient(circle at 75% 85%, rgba(59, 130, 246, .5), transparent 55%), linear-gradient(165deg, #1e3a8a, #0f172a); }
.st-ed-start b { font-size: 1.7rem; }
.st-ed-start p { font-size: 1rem; }
.st-btn { font-size: 1rem; padding: 14px 20px; }
.st-reacts { background: rgba(30, 58, 138, .55); }
.st-who, .st-del { background: rgba(30, 58, 138, .6); font-size: .92rem; }
.st-who-h { font-size: 1.1rem; }
/* подтверждение поверх историй */
.st-ask { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(15, 23, 42, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.st-ask-b { width: min(340px, 100%); padding: 20px; border-radius: 22px; background: #fff; color: #0f172a; text-align: center; box-shadow: 0 30px 60px -20px rgba(2, 6, 23, .7); }
.st-ask-b b { display: block; font: 800 1.15rem var(--font-display, system-ui); }
.st-ask-b p { margin: 6px 0 16px; color: #64748b; font: 500 .95rem var(--font-body, system-ui); }
.st-ask-b div { display: flex; gap: 8px; }
.st-ask-b button { flex: 1; border: 0; border-radius: 14px; padding: 13px; font: 800 .95rem var(--font-body, system-ui); cursor: pointer; background: #f1f5f9; color: #334155; }
.st-ask-b button.ok { background: linear-gradient(135deg, #fb923c, #ea580c); color: #fff; }
.st-pub { white-space: nowrap; font-size: .92rem; padding: 13px 16px; }
.st-ed-bottom .st-hint { flex: 1; min-width: 0; }

/* кнопки-значки под фото: наш скруглённый квадратик, как «поделиться» */
.st-photo-a button.st-pa-ic { width: 52px; height: 52px; padding: 0; display: grid; place-items: center; border-radius: 16px; color: #fff; background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.3); transition: background .15s, transform .15s; }
.st-photo-a button.st-pa-ic:hover { background: rgba(255,255,255,.24); }
.st-photo-a button.st-pa-ic:active { transform: scale(.94); }
.st-photo-a button.st-pa-ic svg { pointer-events: none; }
.st-photo-a { gap: 12px; }
.st-btn .luc-ic { width: 20px; height: 20px; vertical-align: -4px; margin-right: 4px; }
