/* کارت استوری — لایت و دارک */
.bs-btn-story {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
    background: var(--bs-card); color: var(--bs-text); border: 1px solid var(--bs-border);
    border-radius: var(--bs-radius); font-family: inherit; font-size: 12px; font-weight: 900;
    cursor: pointer; transition: var(--bs-transition);
}
.bs-btn-story svg { width: 15px; height: 15px; color: var(--bs-primary); flex-shrink: 0; }
.bs-btn-story:hover { border-color: var(--bs-primary); color: var(--bs-primary); }

html.bs-story-lock, html.bs-story-lock body { overflow: hidden; }
.bs-story-overlay[hidden] { display: none; }
.bs-story-overlay { position: fixed; inset: 0; z-index: 100000; display: flex; align-items: flex-end; justify-content: center; }
.bs-story-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 22, .55); opacity: 0; transition: opacity .25s; }
.bs-story-overlay.is-open .bs-story-backdrop { opacity: 1; }

.bs-story-sheet {
    --st-bg: #ffffff; --st-text: #111827; --st-seg: #efeff1; --st-seg-thumb: #ffffff;
    --st-seg-text: #6b7280; --st-stage: #f6f7f9; --st-border: #e6e8ec; --st-btn: #2b2c36;
    position: relative; width: 100%; max-width: 520px; max-height: 94vh; overflow-y: auto;
    padding: 10px 22px calc(22px + env(safe-area-inset-bottom, 0px));
    background: var(--st-bg); color: var(--st-text); direction: rtl; outline: 0;
    border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2);
    transform: translateY(100%); transition: transform .28s cubic-bezier(.32, .72, 0, 1);
}
html[data-theme="dark"] .bs-story-sheet {
    --st-bg: #131929; --st-text: #e5e7eb; --st-seg: #0c111d; --st-seg-thumb: #232c42;
    --st-seg-text: #94a3b8; --st-stage: #0c111d; --st-border: #232c42; --st-btn: #e5e7eb;
}
.bs-story-overlay.is-open .bs-story-sheet { transform: translateY(0); }
.bs-story-handle { display: flex; justify-content: center; padding: 6px 0 14px; touch-action: none; cursor: grab; }
.bs-story-handle span { width: 92px; height: 5px; border-radius: 9px; background: #c9ccd3; }
html[data-theme="dark"] .bs-story-handle span { background: #3a4358; }

.bs-story-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; font-size: 18px; font-weight: 900; color: var(--st-text); }
.bs-story-title::before { content: ''; width: 5px; height: 26px; border-radius: 4px; background: var(--bs-primary, #dc2626); }

.bs-story-switch { position: relative; display: flex; width: fit-content; margin: 0 auto 16px; padding: 5px; direction: rtl; border-radius: 999px; background: var(--st-seg); }
.bs-story-thumb { position: absolute; top: 5px; bottom: 5px; right: 5px; width: calc(50% - 5px); border-radius: 999px; background: var(--st-seg-thumb); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); transition: transform .26s cubic-bezier(.4, 0, .2, 1); }
.bs-story-switch[data-active="square"] .bs-story-thumb { transform: translateX(-100%); }
.bs-story-switch button { position: relative; z-index: 1; min-width: 108px; padding: 10px 22px; border: 0; background: transparent; font-family: inherit; font-size: 14px; font-weight: 800; color: var(--st-seg-text); cursor: pointer; transition: color .2s; }
.bs-story-switch button.active { color: var(--st-text); }

.bs-story-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 220px; margin-bottom: 18px; padding: 14px; border-radius: 18px; background: var(--st-stage); }
.bs-story-stage canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: 46vh; border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .14); background: #fff; }
.bs-story-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 18px; background: var(--st-stage); color: var(--st-seg-text); font-size: 13px; font-weight: 700; }
.bs-story-loading[hidden] { display: none; }

.bs-story-actions { display: grid; gap: 10px; }
.bs-story-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 17px 20px; border-radius: 999px; font-family: inherit; font-size: 16px; font-weight: 900; cursor: pointer; transition: opacity .2s, transform .1s; }
.bs-story-btn svg { width: 19px; height: 19px; color: var(--bs-primary, #dc2626); flex-shrink: 0; }
.bs-story-btn:active { transform: scale(.985); }
.bs-story-btn:disabled { opacity: .5; cursor: default; }
.bs-story-btn.is-primary { background: var(--st-btn); color: #fff; border: 0; }
html[data-theme="dark"] .bs-story-btn.is-primary { color: #0f172a; }
.bs-story-btn.is-ghost { background: transparent; color: var(--st-text); border: 1px solid var(--st-border); }

@media (min-width: 768px) {
    .bs-story-overlay { align-items: center; }
    .bs-story-sheet { border-radius: 26px; transform: translateY(30px) scale(.98); opacity: 0; transition: transform .25s, opacity .25s; }
    .bs-story-overlay.is-open .bs-story-sheet { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .bs-story-sheet, .bs-story-thumb, .bs-story-backdrop { transition: none; }
}
