/* PrepBuddy shared: buddies rail + buddy activity stories (tokens §7 "Stories rail"; cross-module surfacing).
   One component for Today and Adda. Flutter: StoriesRail + StoryViewer. Tokens only. */

/* ---------- rail ---------- */
.rail { display: flex; gap: 16px; overflow-x: auto; padding: 8px 16px 4px; margin: 0 -16px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.bud { flex: 0 0 auto; width: 66px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: calc(12px * var(--font-scale)); font-weight: 600; color: var(--text-secondary); text-align: center; }
.bud .nm { max-width: 66px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bud .av { position: relative; width: 62px; height: 62px; border-radius: 999px; padding: 3px; background: linear-gradient(135deg, var(--primary), var(--tertiary)); box-sizing: border-box; }
.bud .av .in { width: 56px; height: 56px; border-radius: 999px; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.bud .av .in .pb-avatar { width: 50px; height: 50px; }
.bud.seen .av { background: color-mix(in srgb, var(--text-secondary) 30%, transparent); }
.bud.group .av { background: linear-gradient(135deg, var(--cat-purple), var(--cat-pink)); }
.bud.group .in .mi { font-size: 26px; color: var(--cat-purple-text); }
.bud.group .nm { color: var(--text-primary); }
.rail-k { display: flex; align-items: center; margin-top: 8px; font-size: calc(12px * var(--font-scale)); font-weight: 700; color: var(--text-secondary); }
@media (min-width: 600px) and (max-width: 1023px) { .rail { margin-inline: -24px; padding-inline: 24px; } }
@media (min-width: 1024px) { .rail { padding-inline: 0; margin-inline: 0; } }

/* ---------- buddy / room card (sheet) ---------- */
.bc { display: flex; align-items: center; gap: 12px; }
.bc .pb-avatar { width: 56px; height: 56px; }
.bc b { display: block; font-size: calc(18px * var(--font-scale)); }
.bc .st { font-size: calc(13px * var(--font-scale)); color: var(--text-secondary); display: inline-flex; align-items: center; gap: 8px; opacity: 1; transform: none; animation: none; }
.bc-feed { margin-top: 16px; padding: 12px 16px; border-radius: 16px; background: var(--surface); font-size: calc(14px * var(--font-scale)); line-height: 1.5; }
.bc-feed small { display: block; color: var(--text-secondary); font-size: calc(12px * var(--font-scale)); margin-bottom: 4px; }
.bc-row { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }

/* ---------- story viewer (auto-generated 24 h activity) ---------- */
.sv { position: fixed; inset: 0; z-index: 70; background: color-mix(in srgb, var(--media-ink) 60%, transparent); display: flex; align-items: center; justify-content: center; }
.sv-in { position: relative; width: min(100%, 420px); height: min(100%, 780px); display: flex; flex-direction: column; padding: 16px; box-sizing: border-box; background: linear-gradient(165deg, color-mix(in srgb, var(--accent) 34%, var(--bg)), var(--bg) 70%); color: var(--text-primary); overflow: hidden; }
@media (min-width: 600px) { .sv-in { border-radius: 24px; } }
.sv-seg { display: flex; gap: 4px; }
.sv-seg i { flex: 1; height: 3px; border-radius: 999px; background: color-mix(in srgb, var(--text-primary) 25%, transparent); overflow: hidden; }
.sv-seg i b { display: block; height: 100%; width: 0; background: var(--text-primary); border-radius: 999px; }
.sv-head { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.sv-head .pb-avatar { width: 40px; height: 40px; }
.sv-who { display: flex; align-items: center; gap: 12px; min-height: 44px; padding-inline-end: 8px; border-radius: 12px; text-align: start; color: inherit; }
.sv-who > span { display: flex; flex-direction: column; } .sv-who:hover b, .sv-who:focus-visible b { color: var(--primary-text); }
.sv-head b { display: block; font-size: calc(14px * var(--font-scale)); } .sv-head span { font-size: calc(12px * var(--font-scale)); color: var(--text-secondary); }
.sv-x { margin-inline-start: auto; width: 44px; height: 44px; border-radius: 999px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--text-primary) 10%, transparent); }
.sv-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 24px 8px; }
.sv-card .ic { width: 96px; height: 96px; border-radius: 24px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 22%, transparent); margin-bottom: 8px; }
.sv-card .ic .mi { font-size: 48px; color: var(--accent); }
.sv-card .k { font-size: calc(12px * var(--font-scale)); font-weight: 700; letter-spacing: .04em; color: var(--accent-text, var(--accent)); }
.sv-card h3 { margin: 0; font-size: calc(24px * var(--font-scale)); font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; }
.sv-card .big { font-size: calc(32px * var(--font-scale)); }
.sv-card p { margin: 0; font-size: calc(14px * var(--font-scale)); color: var(--text-secondary); line-height: 1.5; max-width: 300px; }
/* the reply bar (PbStoryReplyBar, 2026-10-12): six quick emoji, then the one-line field and, with text, the send button. Typing freezes the story (the script's `typing` flag);
   `.sv-kb` = the keyboard is up (a phone), so the card compacts; `.sv-done` swaps the bar for "Sent to {name} · Open chat" for 2 s (the viewer covers the toasts, so it confirms itself) */
.sv-in { touch-action: none; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }   /* the viewer never scrolls: a swipe up is a gesture of its own (it opens the field) */
.sv-foot { display: flex; flex-direction: column; gap: 8px; }
.sv-qr { display: flex; justify-content: space-between; gap: 4px; }
.sv-qr button { width: 44px; height: 44px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; line-height: 1; background: color-mix(in srgb, var(--text-primary) 8%, transparent); transition: transform 150ms ease; }
.sv-qr button:active { transform: scale(.9); }
.sv-reply { display: flex; align-items: center; gap: 8px; }
.sv-field { flex: 1; min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 4px; padding-inline: 16px 2px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge); }
.sv-field:focus-within { box-shadow: inset 0 0 0 2px var(--primary); }
.sv-field input { flex: 1; min-width: 0; min-height: 44px; border: 0; outline: 0; background: transparent; font: inherit; font-size: calc(15px * var(--font-scale)); color: var(--text-primary); }
.sv-field input::placeholder { color: var(--text-secondary); }
.sv-fx { width: 44px; height: 44px; flex-shrink: 0; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); } .sv-fx .mi { font-size: 18px; }
.sv-send { flex-shrink: 0; }
.sv-sent { min-height: 100px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: calc(15px * var(--font-scale)); font-weight: 700; }   /* as tall as the bar it replaces, so the card does not jump */
.sv-sent[hidden] { display: none; }
.sv-sent .mi { font-size: 24px; color: var(--success-text); }
.sv-sent button { min-height: 44px; padding: 0 12px; border-radius: 999px; color: var(--primary-text); font-weight: 700; }
.sv-foot.sv-done .sv-qr, .sv-foot.sv-done .sv-reply { display: none; }
.sv-fly { position: absolute; font-size: 32px; line-height: 1; translate: -50% 0; pointer-events: none; animation: svfly 500ms ease-out forwards; }
@keyframes svfly { to { transform: translateY(-140px) scale(1.5); opacity: 0; } }
.sv-card { min-height: 0; }   /* the card gives way, never the reply bar */
.sv-in.sv-kb .sv-card { padding-block: 8px; gap: 8px; }
.sv-in.sv-kb .sv-card .ic { width: 64px; height: 64px; border-radius: 24px; margin-bottom: 0; } .sv-in.sv-kb .sv-card .ic .mi { font-size: 32px; }
.sv-in.sv-kb .sv-card h3 { font-size: calc(20px * var(--font-scale)); } .sv-in.sv-kb .sv-card .big { font-size: calc(28px * var(--font-scale)); }
@media (max-height: 640px) {   /* a short window (a small phone, large text) compacts the card the way the keyboard does */
  .sv-in .sv-card { padding-block: 8px; gap: 8px; }
  .sv-in .sv-card .ic { width: 64px; height: 64px; border-radius: 24px; margin-bottom: 0; } .sv-in .sv-card .ic .mi { font-size: 32px; }
  .sv-in .sv-card h3 { font-size: calc(20px * var(--font-scale)); } .sv-in .sv-card .big { font-size: calc(28px * var(--font-scale)); }
}
.sv-tap { position: absolute; top: 72px; bottom: 132px; width: 30%; } .sv-tap.l { inset-inline-start: 0; } .sv-tap.r { inset-inline-end: 0; width: 70%; }   /* bottom 132: clear of the reply bar (44 + 8 + 48 + the padding) */
.sv .slide-in { animation: svin 300ms cubic-bezier(.16, 1, .3, 1); } @keyframes svin { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sv .slide-in, .sv-fly { animation: none; } .sv-qr button { transition: none; } }
