/* Stories: the bar of rounds in СООБЩЕСТВО, the full-screen viewer and the editor. */
body.story-open { overflow: hidden; }

.avatar {
  display: inline-grid; place-items: center; flex: none; border-radius: 50%;
  font-family: var(--font-pixel); color: #fff; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}
.avatar-m { width: 54px; height: 54px; font-size: 13px; }
.avatar-s { width: 30px; height: 30px; font-size: 8px; }

.stories-bar { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 0 6px; list-style: none; scrollbar-width: none; }
.stories-bar::-webkit-scrollbar { display: none; }
.story-round { display: grid; justify-items: center; gap: 5px; width: 66px; background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; }
.story-ring { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--accent), var(--r6), var(--accent-2), var(--accent)); }
.story-ring .avatar { box-shadow: 0 0 0 3px var(--bg); }
.story-ring.seen { background: var(--line); }
.story-ring.empty { background: transparent; border: 2px dashed var(--line); }
.story-name { max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); }

/* Viewer */
.story-viewer, .story-editor {
  position: fixed; inset: 0; z-index: 55; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.story-frame {
  position: relative; height: min(100%, calc(100vw * 16 / 9)); aspect-ratio: 9 / 16; max-width: 100%;
  background: #111; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
}
.story-picture { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.story-top { position: absolute; inset: 0 0 auto; padding: 10px 10px 18px; background: linear-gradient(rgba(0, 0, 0, 0.55), transparent); }
.story-bars { display: flex; gap: 4px; }
.story-bar { flex: 1; height: 3px; background: rgba(255, 255, 255, 0.3); overflow: hidden; }
.story-bar i { display: block; height: 100%; width: 0; background: #fff; }
.story-head { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.story-who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.story-who .muted { color: rgba(255, 255, 255, 0.7); }
.story-head-actions { display: flex; gap: 4px; }
.story-head-actions .btn { color: #fff; }
.story-card-btn { position: absolute; right: 12px; bottom: 14px; }
.story-like {
  position: absolute; left: 12px; bottom: 14px; display: inline-flex; align-items: center; gap: 8px; min-width: 56px; min-height: 36px; padding: 6px 10px;
  font-family: var(--font-pixel); font-size: 10px; color: #fff; background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.6); cursor: pointer;
}
.story-like[aria-pressed='true'] { color: #ff4d6d; border-color: #ff4d6d; }
.story-like:disabled { cursor: default; }
.heart-icon { width: 21px; height: 18px; }
.story-card-layer {
  position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; padding: 12px;
  background: var(--bg); overflow: auto;
}
.story-card-close { align-self: flex-end; margin-bottom: 8px; }
.story-confirm {
  position: absolute; left: 12px; right: 12px; bottom: 64px; z-index: 2; display: grid; gap: 10px; padding: 14px;
  background: var(--panel); border: var(--px) solid var(--ink); box-shadow: var(--bevel);
}
.story-card-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.story-card-body .tcard-stage { overflow: auto; }

/* Editor */
.story-editor { justify-content: flex-start; gap: 8px; padding-top: max(8px, env(safe-area-inset-top)); overflow-y: auto; background: var(--bg); }
.story-editor-head { display: flex; align-items: center; justify-content: space-between; width: min(100%, 520px); padding: 0 8px; }
.story-stage { display: flex; justify-content: center; width: 100%; }
.story-canvas { height: min(58vh, calc((100vw - 16px) * 16 / 9)); aspect-ratio: 9 / 16; background: #000; touch-action: none; border: var(--px) solid var(--ink); }
.story-tools, .story-panel { width: min(100%, 520px); padding: 0 8px; }
.story-panel { display: grid; gap: 8px; padding-bottom: 16px; }
.story-chips { flex-wrap: wrap; }
.story-text-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.story-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.swatch { width: 28px; height: 28px; border: var(--px) solid var(--ink); cursor: pointer; }
.swatch.active { outline: 2px solid var(--accent); outline-offset: 2px; }
.story-track { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story-wave { width: 100%; height: 72px; background: var(--panel); border: var(--px) solid var(--ink); touch-action: none; cursor: grab; }
.story-clip-label { font-size: 12px; }
