/* =====================================================================
   ArshamChatino — Premium "Glass / Aurora" theme layer
   Loaded AFTER app.css. Only overrides visual styling (colors, glass,
   shadows, blur, motion). No layout / structural / JS-hook changes,
   so every existing feature keeps working exactly as before.
   ===================================================================== */

/* ---------- 1. DESIGN TOKENS ---------- */
:root {
    /* accent (enhanced telegram blue) */
    --pro-accent-1: #37b6ff;
    --pro-accent-2: #2a8cf0;
    --pro-accent-3: #6ad4ff;
    --pro-accent-grad: linear-gradient(135deg, #47c2ff 0%, #2a8cf0 55%, #2f6ff0 100%);
    --pro-accent-soft: rgba(55, 182, 255, 0.16);
    --pro-ring: rgba(55, 182, 255, 0.45);

    /* glass surfaces */
    --pro-glass: rgba(22, 33, 46, 0.62);
    --pro-glass-strong: rgba(20, 30, 43, 0.80);
    --pro-glass-2: rgba(30, 43, 58, 0.55);
    --pro-glass-border: rgba(255, 255, 255, 0.10);
    --pro-glass-highlight: rgba(255, 255, 255, 0.06);
    --pro-blur: saturate(160%) blur(20px);
    --pro-blur-lite: saturate(140%) blur(12px);

    /* shadows */
    --pro-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
    --pro-shadow-md: 0 12px 34px rgba(0, 0, 0, 0.42);
    --pro-shadow-lg: 0 26px 70px rgba(5, 12, 22, 0.62);
    --pro-glow: 0 6px 26px rgba(42, 140, 240, 0.42);

    /* remap existing token families so the whole app follows */
    --tg-accent: #37b6ff;
    --tg-accent-2: #2a8cf0;
    --tg-bubble-out: linear-gradient(135deg, #2f8ff2 0%, #2a72e6 100%);
    --tg-bubble-in: rgba(30, 43, 58, 0.72);
    --tg-panel: rgba(22, 33, 46, 0.60);
    --tg-surface: rgba(18, 27, 39, 0.72);
    --tg-surface-2: rgba(30, 43, 58, 0.60);
    --tg-border: rgba(255, 255, 255, 0.09);
    --tg-divider: rgba(255, 255, 255, 0.06);
    --tg-input: rgba(9, 16, 24, 0.55);
    --tg-hover: rgba(55, 182, 255, 0.12);
    --tg-text: #eef4fb;
    --tg-text-secondary: #93a6bd;
    --tg-unread-bg: #37b6ff;

    --primary: #37b6ff;
    --primary-dark: #2a8cf0;
    --border-color: rgba(255, 255, 255, 0.09);
    --bg-header: rgba(22, 33, 46, 0.62);
    --bg-input: rgba(9, 16, 24, 0.55);
    --bg-msg-user: linear-gradient(135deg, #2f8ff2 0%, #2a72e6 100%);
    --bg-msg-other: rgba(30, 43, 58, 0.72);
    --text-primary: #eef4fb;
    --text-secondary: #93a6bd;
    --shadow-glow: 0 6px 26px rgba(42, 140, 240, 0.42);
    --reaction-bg: rgba(255, 255, 255, 0.08);
    --reaction-border: rgba(255, 255, 255, 0.10);

    /* aurora background stops */
    --aurora-1: rgba(47, 143, 242, 0.30);
    --aurora-2: rgba(106, 212, 255, 0.16);
    --aurora-3: rgba(64, 92, 214, 0.20);
    --aurora-base: #0a121c;
}

body.light-mode {
    --pro-glass: rgba(255, 255, 255, 0.66);
    --pro-glass-strong: rgba(255, 255, 255, 0.82);
    --pro-glass-2: rgba(255, 255, 255, 0.58);
    --pro-glass-border: rgba(17, 30, 48, 0.10);
    --pro-glass-highlight: rgba(255, 255, 255, 0.55);
    --pro-shadow-sm: 0 2px 10px rgba(31, 58, 102, 0.10);
    --pro-shadow-md: 0 14px 34px rgba(31, 58, 102, 0.16);
    --pro-shadow-lg: 0 26px 60px rgba(31, 58, 102, 0.20);
    --pro-glow: 0 8px 24px rgba(42, 140, 240, 0.28);

    --tg-bubble-out: linear-gradient(135deg, #45b0ff 0%, #2a8cf0 100%);
    --tg-bubble-in: rgba(255, 255, 255, 0.86);
    --tg-panel: rgba(255, 255, 255, 0.66);
    --tg-surface: rgba(246, 249, 253, 0.78);
    --tg-surface-2: rgba(255, 255, 255, 0.6);
    --tg-border: rgba(17, 30, 48, 0.10);
    --tg-divider: rgba(17, 30, 48, 0.08);
    --tg-input: rgba(255, 255, 255, 0.75);
    --tg-hover: rgba(42, 140, 240, 0.08);
    --tg-text: #11213a;
    --tg-text-secondary: #5b7089;

    --bg-msg-user: linear-gradient(135deg, #45b0ff 0%, #2a8cf0 100%);
    --bg-msg-other: rgba(255, 255, 255, 0.86);
    --text-primary: #11213a;
    --text-secondary: #5b7089;
    --reaction-bg: rgba(17, 30, 48, 0.06);
    --reaction-border: rgba(17, 30, 48, 0.10);

    --aurora-1: rgba(66, 158, 255, 0.22);
    --aurora-2: rgba(120, 200, 255, 0.18);
    --aurora-3: rgba(150, 130, 255, 0.16);
    --aurora-base: #dde8f4;
}

/* ---------- 2. AURORA BACKGROUND ---------- */
@keyframes proAurora {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(0, -3%, 0) scale(1.08); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
}
body {
    background: var(--aurora-base) !important;
    background-image:
        radial-gradient(60vw 60vh at 12% -10%, var(--aurora-1), transparent 60%),
        radial-gradient(55vw 55vh at 108% 8%, var(--aurora-2), transparent 58%),
        radial-gradient(70vw 60vh at 50% 120%, var(--aurora-3), transparent 60%) !important;
    background-attachment: fixed;
}
#main-container.tg-app {
    position: relative;
    background:
        radial-gradient(50vw 50vh at 10% -8%, var(--aurora-1), transparent 55%),
        radial-gradient(45vw 45vh at 110% 6%, var(--aurora-2), transparent 55%),
        radial-gradient(60vw 55vh at 55% 118%, var(--aurora-3), transparent 58%),
        var(--aurora-base) !important;
}

/* ---------- 3. SIDEBAR ---------- */
.tg-sidebar {
    background: var(--pro-glass) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border-inline-end: 1px solid var(--pro-glass-border) !important;
    box-shadow: inset -1px 0 0 var(--pro-glass-highlight);
}
.tg-sidebar-header {
    background: transparent !important;
    border-bottom: 1px solid var(--pro-glass-border) !important;
}
.tg-app-title { font-weight: 700; letter-spacing: .2px; }
.tg-search input {
    background: var(--tg-input) !important;
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 14px !important;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.tg-search input:focus {
    border-color: var(--pro-ring) !important;
    box-shadow: 0 0 0 3px var(--pro-accent-soft) !important;
}

/* folder tabs */
.tg-folder-tab {
    border-radius: 999px !important;
    transition: color .2s ease, background .2s ease, box-shadow .2s ease;
}
.tg-folder-tab.is-active {
    background: var(--pro-accent-grad) !important;
    color: #fff !important;
    box-shadow: var(--pro-glow) !important;
}

/* chat list items */
.tg-chat-item {
    border-radius: 14px !important;
    margin: 2px 8px !important;
    transition: background .18s ease, transform .18s ease, box-shadow .18s ease !important;
}
.tg-chat-item:hover {
    background: var(--tg-hover) !important;
    transform: translateX(-2px);
}
.tg-chat-item.active {
    background: var(--pro-accent-grad) !important;
    color: #fff !important;
    box-shadow: var(--pro-glow) !important;
}
.tg-chat-item.active .tg-chat-title,
.tg-chat-item.active .tg-chat-snippet { color: #fff !important; }
.tg-create-btn {
    border-radius: 999px !important;
    transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.tg-create-btn:hover { transform: translateY(-1px); box-shadow: var(--pro-glow); }

/* avatars */
.tg-avatar {
    background: var(--pro-accent-grad) !important;
    box-shadow: 0 4px 14px rgba(42, 140, 240, 0.38);
    color: #fff !important;
}

/* ---------- 4. TOPBAR ---------- */
.header, .tg-topbar {
    background: var(--pro-glass) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border-bottom: 1px solid var(--pro-glass-border) !important;
    box-shadow: var(--pro-shadow-sm);
}
.topbar-menu {
    background: var(--pro-glass-strong) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 16px !important;
    box-shadow: var(--pro-shadow-md) !important;
}
.topbar-menu-item { border-radius: 10px !important; transition: background .15s ease; }
.topbar-menu-item:hover { background: var(--tg-hover) !important; }

/* ---------- 5. CHAT AREA + BUBBLES ---------- */
.chat-container {
    background:
        radial-gradient(40vw 40vh at 18% 0%, rgba(55,182,255,0.06), transparent 60%),
        radial-gradient(36vw 36vh at 90% 12%, rgba(106,212,255,0.05), transparent 60%),
        transparent !important;
}
.message {
    border-radius: 18px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16) !important;
    backdrop-filter: none;
}
.user-message {
    background: var(--tg-bubble-out) !important;
    color: #fff !important;
    border-bottom-left-radius: 6px !important;
    box-shadow: 0 6px 20px rgba(42, 120, 230, 0.34) !important;
}
.other-message {
    background: var(--tg-bubble-in) !important;
    -webkit-backdrop-filter: var(--pro-blur-lite);
    backdrop-filter: var(--pro-blur-lite);
    border: 1px solid var(--pro-glass-border) !important;
    border-bottom-right-radius: 6px !important;
    color: var(--tg-text) !important;
}
.reply-preview, .replied-message {
    border-radius: 10px !important;
}
.scroll-to-bottom {
    background: var(--pro-glass-strong) !important;
    -webkit-backdrop-filter: var(--pro-blur-lite);
    backdrop-filter: var(--pro-blur-lite);
    border: 1px solid var(--pro-glass-border) !important;
    box-shadow: var(--pro-shadow-md) !important;
    transition: transform .15s ease, box-shadow .2s ease;
}
.scroll-to-bottom:hover { transform: translateY(-2px) scale(1.05); }

/* ---------- 6. COMPOSER (desktop + mobile) ---------- */
.input-area-wrapper, .footer {
    background: var(--pro-glass) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border-top: 1px solid var(--pro-glass-border) !important;
}
.desktop-input, .mobile-floating-input {
    background: var(--tg-input) !important;
    border-radius: 16px !important;
    border: 1px solid transparent !important;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.desktop-input:focus {
    border-color: var(--pro-ring) !important;
    box-shadow: 0 0 0 3px var(--pro-accent-soft) !important;
}
.mobile-input-pill {
    background: var(--tg-input) !important;
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 22px !important;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.mobile-input-pill:focus-within {
    border-color: var(--pro-ring) !important;
    box-shadow: 0 0 0 3px var(--pro-accent-soft) !important;
}

/* action + send buttons */
.action-btn, .mobile-icon-btn {
    border-radius: 14px !important;
    transition: color .18s ease, background .18s ease, transform .12s ease !important;
}
.action-btn:hover, .mobile-icon-btn:hover {
    background: var(--tg-hover) !important;
    color: var(--pro-accent-1) !important;
    transform: translateY(-1px);
}
.send-btn, .ios-send-btn.btn-send {
    background: var(--pro-accent-grad) !important;
    box-shadow: var(--pro-glow) !important;
    transition: transform .14s ease, box-shadow .2s ease, filter .2s ease !important;
}
.send-btn:hover, .ios-send-btn.btn-send:hover {
    transform: translateY(-1px) scale(1.04);
    filter: brightness(1.06);
}

/* emoji picker */
.emoji-picker {
    background: var(--pro-glass-strong) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 18px !important;
    box-shadow: var(--pro-shadow-md) !important;
}
.emoji { border-radius: 10px !important; transition: transform .12s ease, background .12s ease; }
.emoji:hover { background: var(--tg-hover) !important; transform: scale(1.2); }

/* ---------- 7. GENERIC BUTTONS ---------- */
.login-btn, .preview-send-btn {
    background: var(--pro-accent-grad) !important;
    border-radius: 14px !important;
    box-shadow: var(--pro-glow) !important;
    transition: transform .14s ease, box-shadow .2s ease, filter .2s ease !important;
}
.login-btn:hover, .preview-send-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 10px 30px rgba(42, 140, 240, 0.5) !important;
}
.link-choice-btn {
    border-radius: 12px !important;
    border: 1px solid var(--pro-glass-border) !important;
    transition: transform .14s ease, box-shadow .2s ease, background .2s ease;
}
.link-choice-btn:not(.secondary) { box-shadow: var(--pro-glow); }
.link-choice-btn:hover { transform: translateY(-1px); }
.auth-link-btn { transition: color .18s ease; }

/* OTP inputs */
.otp-digit {
    border-radius: 12px !important;
    border: 1px solid var(--pro-glass-border) !important;
    background: var(--tg-input) !important;
    transition: border-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.otp-digit:focus {
    border-color: var(--pro-ring) !important;
    box-shadow: 0 0 0 3px var(--pro-accent-soft) !important;
    transform: translateY(-1px);
}
.login-input {
    border-radius: 12px !important;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.login-input:focus {
    border-color: var(--pro-ring) !important;
    box-shadow: 0 0 0 3px var(--pro-accent-soft) !important;
}

/* ---------- 8. MODALS / POPUPS ---------- */
.modal-overlay {
    background: rgba(6, 12, 22, 0.55) !important;
    -webkit-backdrop-filter: saturate(120%) blur(8px);
    backdrop-filter: saturate(120%) blur(8px);
}
.modal-content {
    background: var(--pro-glass-strong) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 22px !important;
    box-shadow: var(--pro-shadow-lg) !important;
}
.modal-content::before {
    /* subtle top highlight line */
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--pro-glass-highlight), transparent);
    border-radius: 22px 22px 0 0;
    pointer-events: none;
}
.preview-header { border-bottom: 1px solid var(--pro-glass-border) !important; }
.preview-close-btn, .lightbox-close {
    border-radius: 10px !important;
    transition: background .15s ease, transform .12s ease;
}
.preview-close-btn:hover { background: var(--tg-hover) !important; transform: rotate(90deg); }
.tg-auth-logo {
    background: var(--pro-accent-grad) !important;
    box-shadow: var(--pro-glow) !important;
}
.tg-auth-title, .brand-glow { color: var(--pro-accent-1) !important; }

/* message context menu + reaction picker */
.message-context-menu {
    background: var(--pro-glass-strong) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 16px !important;
    box-shadow: var(--pro-shadow-md) !important;
}
.menu-item { border-radius: 10px !important; transition: background .14s ease; }
.menu-item:hover { background: var(--tg-hover) !important; }
.reaction-picker {
    background: var(--pro-glass-strong) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 999px !important;
    box-shadow: var(--pro-shadow-md) !important;
}

/* reactions on bubbles */
.reaction-item {
    border-radius: 999px !important;
    border: 1px solid var(--reaction-border) !important;
    transition: transform .12s ease, background .15s ease;
}
.reaction-item:hover { transform: translateY(-1px) scale(1.05); }
.reaction-item.is-active {
    background: var(--pro-accent-grad) !important;
    border-color: transparent !important;
    box-shadow: var(--pro-glow) !important;
}

/* toast */
.private-toast-stack .private-toast,
.mobile-notification, .toast {
    background: var(--pro-glass-strong) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 14px !important;
    box-shadow: var(--pro-shadow-md) !important;
}

/* ---------- 9. LIVE STREAM ROOM (پخش زنده موج‌ها) ---------- */
.live-room-shell.stream-center-card {
    background:
        radial-gradient(60% 60% at 20% 0%, rgba(55,182,255,0.18), transparent 60%),
        radial-gradient(50% 50% at 100% 10%, rgba(106,212,255,0.12), transparent 60%),
        var(--pro-glass-strong) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 24px !important;
    box-shadow: var(--pro-shadow-lg) !important;
}
.live-room-header { border-bottom: 1px solid var(--pro-glass-border) !important; }
.live-room-avatar, .live-orb {
    background: var(--pro-accent-grad) !important;
    color: #fff !important;
    box-shadow: 0 0 40px rgba(55, 182, 255, 0.5) !important;
}
@keyframes proOrbPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(55,182,255,0.45); }
    50%      { box-shadow: 0 0 60px rgba(55,182,255,0.75); }
}
.live-orb { animation: proOrbPulse 2.6s ease-in-out infinite; }
.live-stage-card {
    background: var(--pro-glass-2) !important;
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 20px !important;
    box-shadow: inset 0 1px 0 var(--pro-glass-highlight), var(--pro-shadow-sm) !important;
}
.live-room-status {
    color: #ff5a7a !important;
    letter-spacing: 2px;
    font-weight: 800;
}
.live-room-status::before {
    content: "";
    display: inline-block;
    width: 8px; height: 8px;
    margin-inline-end: 7px;
    border-radius: 50%;
    background: #ff375f;
    box-shadow: 0 0 12px #ff375f;
    animation: proOrbPulse 1.4s ease-in-out infinite;
    vertical-align: middle;
}
/* animated waveform bars */
.live-waveform span {
    background: var(--pro-accent-grad) !important;
    border-radius: 999px !important;
}
.live-waveform:not(.is-paused) span { animation: proWave 1s ease-in-out infinite; }
.live-waveform span:nth-child(2n) { animation-delay: .15s; }
.live-waveform span:nth-child(3n) { animation-delay: .3s; }
.live-waveform span:nth-child(4n) { animation-delay: .45s; }
@keyframes proWave {
    0%, 100% { transform: scaleY(0.4); opacity: .7; }
    50%      { transform: scaleY(1); opacity: 1; }
}
.live-control-btn {
    border-radius: 14px !important;
    transition: transform .14s ease, box-shadow .2s ease, background .2s ease;
}
.live-control-btn:not(.secondary) {
    background: var(--pro-accent-grad) !important;
    box-shadow: var(--pro-glow) !important;
}
.live-control-btn:hover { transform: translateY(-1px) scale(1.04); }
.live-room-side .login-input,
.live-custom-row .login-input { border-radius: 12px !important; }
.stream-list { scrollbar-width: thin; }
.stream-item, .stream-list > * {
    border-radius: 12px !important;
    transition: background .15s ease, transform .12s ease;
}
.stream-item:hover { background: var(--tg-hover) !important; transform: translateX(-2px); }
.live-volume { accent-color: var(--pro-accent-1); }

/* link modal live-stream preview card */
.link-preview-stream {
    background: var(--pro-glass-2) !important;
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 14px !important;
}
.link-stream-icon { color: var(--pro-accent-1) !important; }

/* ---------- 10. STORIES ---------- */
.story-strip {
    background: transparent !important;
    border-bottom: 1px solid var(--pro-glass-border) !important;
}
.story-create-btn {
    border-radius: 14px !important;
    border: 1px dashed var(--pro-ring) !important;
    color: var(--pro-accent-1) !important;
    transition: background .15s ease, transform .12s ease;
}
.story-create-btn:hover { background: var(--tg-hover) !important; transform: translateY(-1px); }
.story-ring, .story-item .story-avatar-ring {
    background: conic-gradient(from 210deg, #47c2ff, #2a8cf0, #6ad4ff, #47c2ff) !important;
}
.story-mode-btn.is-active {
    background: var(--pro-accent-grad) !important;
    color: #fff !important;
    box-shadow: var(--pro-glow) !important;
}
.story-view-card {
    border-radius: 22px !important;
    box-shadow: var(--pro-shadow-lg) !important;
}

/* ---------- 11. VOICE UI ---------- */
.voice-recording-bar, .voice-preview-bar {
    background: var(--pro-glass-strong) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 18px !important;
    box-shadow: var(--pro-shadow-sm) !important;
}
.voice-circle-btn, .voice-send-btn {
    background: var(--pro-accent-grad) !important;
    box-shadow: var(--pro-glow) !important;
}
.voice-wave-bars span, .voice-recording-wave span {
    background: var(--pro-accent-grad) !important;
}
.voice-recording-dot { background: #ff375f !important; box-shadow: 0 0 12px #ff375f; }

/* ---------- 12. CONNECTION STATUS (footer) ---------- */
.footer { background: transparent !important; }
.connection-status {
    border-radius: 999px !important;
    padding: 5px 14px !important;
    gap: 8px !important;
    font-size: 0.74rem !important;
    font-weight: 600;
    letter-spacing: .1px;
    border: 1px solid var(--pro-glass-border) !important;
    -webkit-backdrop-filter: var(--pro-blur-lite);
    backdrop-filter: var(--pro-blur-lite);
    box-shadow: var(--pro-shadow-sm);
    transition: color .25s ease, background .25s ease;
}
.connection-status.online {
    color: #4be08b !important;
    background: rgba(51, 209, 122, 0.10) !important;
}
.connection-status.offline {
    color: #ff8a8a !important;
    background: rgba(255, 107, 107, 0.10) !important;
}
.connection-status .status-dot { width: 8px !important; height: 8px !important; border-radius: 50%; }
.connection-status.online .status-dot {
    background: #33d17a; box-shadow: 0 0 10px #33d17a;
    animation: proOrbPulse 2s ease-in-out infinite;
}
.connection-status.offline .status-dot { background: #ff6b6b; box-shadow: 0 0 10px #ff6b6b; }
body.light-mode .connection-status.online { color: #1f9e5a !important; }
body.light-mode .connection-status.offline { color: #d24d57 !important; }

/* ---------- 13. SCROLLBARS + MISC POLISH ---------- */
* { scrollbar-width: thin; scrollbar-color: rgba(120,150,190,0.4) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: linear-gradient(var(--pro-accent-2), var(--pro-accent-1));
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--pro-accent-1); background-clip: padding-box; }

::selection { background: var(--pro-accent-soft); color: inherit; }

button, a, .action-btn, .tg-icon-btn, .menu-item, .emoji { -webkit-tap-highlight-color: transparent; }

/* ---------- 14. LIVE THEATER (fullscreen live view + its chat) ---------- */
/* topbar / controls glass */
.stream-theater .theater-topbar {
    background: linear-gradient(to bottom, rgba(6,12,22,0.72), transparent) !important;
}
.stream-theater .theater-controls {
    background: linear-gradient(to top, rgba(6,12,22,0.66), transparent) !important;
}
.theater-live { background: #ff375f !important; box-shadow: 0 4px 16px rgba(255,55,95,0.45); }
.theater-close, .theater-ctrl {
    background: rgba(255,255,255,0.14) !important;
    -webkit-backdrop-filter: var(--pro-blur-lite);
    backdrop-filter: var(--pro-blur-lite);
    transition: background .15s ease, transform .14s ease;
}
.theater-close:hover, .theater-ctrl:hover { background: rgba(255,255,255,0.26) !important; transform: translateY(-1px); }
.theater-ctrl#theater-play { background: var(--pro-accent-grad) !important; box-shadow: var(--pro-glow); }
.theater-volume { accent-color: var(--pro-accent-1) !important; }
.theater-react-row button {
    background: rgba(255,255,255,0.12) !important;
    -webkit-backdrop-filter: var(--pro-blur-lite);
    backdrop-filter: var(--pro-blur-lite);
    transition: transform .12s ease, background .14s ease;
}
.theater-react-row button:hover { background: rgba(255,255,255,0.24) !important; transform: translateY(-2px) scale(1.06); }

/* chat comments — premium glass bubbles */
.theater-comments {
    inset-inline-start: 14px;
    gap: 8px !important;
}
.theater-comment {
    background: rgba(12, 20, 32, 0.5) !important;
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    backdrop-filter: saturate(160%) blur(10px);
    border: 1px solid rgba(255,255,255,0.10) !important;
    border-radius: 14px !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.28) !important;
    padding: 7px 12px !important;
}
.theater-comment b {
    color: transparent !important;
    background: linear-gradient(135deg, #6ad4ff, #37b6ff) !important;
    -webkit-background-clip: text; background-clip: text;
    font-weight: 800 !important;
}
.theater-comment.just-in { animation: proCommentIn .32s cubic-bezier(.2,.8,.2,1); }
@keyframes proCommentIn {
    from { opacity: 0; transform: translateY(10px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* comment bar — fades out when idle, like the top bar; appears on
   focus / hover / when the player controls are revealed */
.stream-theater .theater-comment-bar {
    background: linear-gradient(to top, rgba(6,12,22,0.70), transparent) !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    opacity: 0.22;
    transform: translateY(18%);
    transition: opacity .35s ease, transform .35s ease, background .35s ease, backdrop-filter .35s ease;
}
.stream-theater.controls-on .theater-comment-bar,
.stream-theater .theater-comment-bar:hover,
.stream-theater .theater-comment-bar:focus-within {
    opacity: 1;
    transform: translateY(0);
    background: linear-gradient(to top, rgba(6,12,22,0.92), rgba(6,12,22,0.30)) !important;
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
}
.theater-comment-bar input {
    background: rgba(255,255,255,0.10) !important;
    border: 1px solid rgba(255,255,255,0.14) !important;
    border-radius: 999px !important;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.theater-comment-bar input:focus {
    border-color: var(--pro-ring) !important;
    box-shadow: 0 0 0 3px var(--pro-accent-soft) !important;
    background: rgba(255,255,255,0.14) !important;
}
.theater-comment-bar button {
    background: var(--pro-accent-grad) !important;
    box-shadow: var(--pro-glow) !important;
    transition: transform .14s ease, filter .2s ease;
}
.theater-comment-bar button:hover { transform: translateY(-1px) scale(1.05); filter: brightness(1.06); }

/* ---------- 15. ELEGANT MODAL/POPUP ENTER + EXIT ANIMATION ---------- */
.modal-overlay {
    transition: opacity .30s ease, visibility .30s ease,
                -webkit-backdrop-filter .30s ease, backdrop-filter .30s ease !important;
}
.modal-content {
    opacity: 0;
    transform: translateY(26px) scale(0.94);
    transition: transform .40s cubic-bezier(.16, 1, .3, 1), opacity .30s ease !important;
    will-change: transform, opacity;
}
.modal-overlay.active .modal-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ---------- 16. LIGHT MODE FIXES (dark stays default) ---------- */
body.light-mode {
    /* more opaque glass so text stays readable on bright aurora */
    --pro-glass: rgba(255,255,255,0.80);
    --pro-glass-strong: rgba(255,255,255,0.92);
    --pro-glass-2: rgba(255,255,255,0.74);
    --aurora-base: #e8eff8;
}
body.light-mode .tg-sidebar,
body.light-mode .header,
body.light-mode .tg-topbar,
body.light-mode .input-area-wrapper,
body.light-mode .footer {
    box-shadow: 0 1px 0 rgba(17,30,48,0.05);
}
/* inputs: visible border + dark text in light mode */
body.light-mode .desktop-input,
body.light-mode .mobile-floating-input,
body.light-mode .login-input,
body.light-mode .tg-search input {
    background: rgba(255,255,255,0.92) !important;
    color: #11213a !important;
    border-color: rgba(17,30,48,0.12) !important;
}
body.light-mode .desktop-input::placeholder,
body.light-mode .mobile-floating-input::placeholder,
body.light-mode .login-input::placeholder,
body.light-mode .tg-search input::placeholder { color: #7488a0 !important; }
/* other-person bubble: solid white, dark text, soft shadow */
body.light-mode .other-message {
    background: #ffffff !important;
    color: #11213a !important;
    border-color: rgba(17,30,48,0.08) !important;
    box-shadow: 0 3px 12px rgba(31,58,102,0.10) !important;
}
/* menus / pickers readable */
body.light-mode .topbar-menu,
body.light-mode .message-context-menu,
body.light-mode .reaction-picker,
body.light-mode .emoji-picker,
body.light-mode .modal-content {
    color: #11213a !important;
}
body.light-mode .topbar-menu-item,
body.light-mode .menu-item { color: #11213a !important; }
/* action icons need enough contrast on light glass */
body.light-mode .action-btn,
body.light-mode .mobile-icon-btn,
body.light-mode .tg-icon-btn { color: #46586e; }
/* live room text on light glass */
body.light-mode .live-room-shell.stream-center-card,
body.light-mode .live-stage-card,
body.light-mode .live-room-current,
body.light-mode .stream-item { color: #11213a; }
body.light-mode .scroll-to-bottom { color: #46586e; }

/* ---------- 17. STORY STRIP — simple & elegant (all viewports) ---------- */
.story-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px !important;
    background: transparent !important;
    border-bottom: 1px solid var(--pro-glass-border) !important;
}
.story-item {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px !important;
    background: transparent !important;
    border: 0 !important;
    padding: 0 !important;
    cursor: pointer;
    width: 68px;
}
.story-item .story-ring {
    width: 62px; height: 62px;
    border-radius: 50% !important;
    padding: 3px !important;
    background: conic-gradient(from 210deg, #47c2ff, #2a8cf0, #6ad4ff, #a06bff, #47c2ff) !important;
    display: grid; place-items: center;
    transition: transform .16s ease;
}
.story-item:hover .story-ring { transform: scale(1.05); }
.story-item.is-seen .story-ring {
    background: var(--pro-glass-border) !important;
    filter: none;
}
body.light-mode .story-item.is-seen .story-ring { background: rgba(17,30,48,0.18) !important; }
.story-item .story-avatar {
    width: 100%; height: 100%;
    border-radius: 50% !important;
    background-size: cover; background-position: center;
    display: grid; place-items: center;
    font-weight: 800; color: #fff;
    border: 2px solid var(--aurora-base) !important;
    background-color: #2a8cf0;
}
.story-item > span:last-child {
    font-size: 0.72rem;
    color: var(--tg-text-secondary);
    max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
}
.story-create-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    width: 68px; min-width: 68px;
    background: transparent !important;
    border: 0 !important;
    color: var(--tg-text-secondary) !important;
    font-size: 0 !important;            /* hide the original inline "+ استوری" text */
    cursor: pointer;
    padding: 0 !important;
}
.story-create-btn::before {
    content: "+";
    width: 62px; height: 62px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 1.7rem; font-weight: 300; line-height: 1;
    color: #fff;
    background: var(--pro-accent-grad);
    box-shadow: var(--pro-glow);
    border: 2px solid var(--aurora-base);
}
.story-create-btn::after { content: "استوری شما"; font-size: 0.72rem; color: var(--tg-text-secondary); }

/* ---------- 18. STORY VIEWER — Instagram style ---------- */
.story-view-card {
    width: min(430px, 96vw) !important;
    height: min(92vh, 860px) !important;
    max-width: 430px !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    background: #000 !important;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6) !important;
    position: relative;
    padding: 0 !important;
}
.story-progress-track {
    position: absolute; top: 8px; inset-inline: 10px;
    display: flex; gap: 4px; z-index: 8;
}
.story-progress-seg {
    flex: 1; height: 3px; border-radius: 3px;
    background: rgba(255,255,255,0.32) !important;
    overflow: hidden;
}
.story-progress-fill {
    display: block; height: 100%;
    background: #fff !important;
    border-radius: 3px;
}
.story-view-header {
    position: absolute; top: 18px; inset-inline: 10px;
    z-index: 8;
    display: flex; align-items: center; justify-content: space-between;
    background: transparent !important;
    border: 0 !important;
    padding: 6px 4px !important;
    transition: opacity .2s ease;
}
.story-view-header::before {
    content: ""; position: absolute; inset: -18px -10px auto -10px; height: 96px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
    z-index: -1; pointer-events: none;
}
.story-view-user { display: flex; align-items: center; gap: 9px; }
.story-view-meta strong { color: #fff; font-size: 0.9rem; }
.story-view-meta span { color: rgba(255,255,255,0.72); font-size: 0.74rem; }
.story-view-header .tg-avatar { width: 38px; height: 38px; background-size: cover; background-position: center; }
.story-head-icon-btn, .story-view-close {
    color: #fff !important;
    background: transparent !important;
    transition: transform .14s ease, background .14s ease;
    border-radius: 50%;
}
.story-head-icon-btn:hover, .story-view-close:hover { background: rgba(255,255,255,0.16) !important; }

/* reply bar — IG look */
.story-view-replybar {
    position: absolute; bottom: 0; inset-inline: 0; z-index: 8;
    display: flex; align-items: center; gap: 10px;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom)) !important;
    background: linear-gradient(to top, rgba(0,0,0,0.62), transparent) !important;
    border: 0 !important;
    transition: opacity .2s ease;
}
.story-view-reply-input {
    flex: 1; height: 44px; border-radius: 999px !important;
    background: transparent !important;
    border: 1.5px solid rgba(255,255,255,0.55) !important;
    color: #fff !important;
    padding: 0 18px !important;
    font-size: 0.9rem;
}
.story-view-reply-input::placeholder { color: rgba(255,255,255,0.75); }
.story-view-reply-input:focus { border-color: #fff !important; box-shadow: none !important; }
.story-view-reply-icon, .story-view-reply-send {
    width: 42px; height: 42px; flex: 0 0 auto;
    display: grid; place-items: center;
    background: transparent !important;
    border: 0 !important;
    color: #fff !important;
    cursor: pointer;
    border-radius: 50%;
    transition: transform .14s ease, background .14s ease;
    padding: 0 !important;
}
.story-view-reply-icon:hover, .story-view-reply-send:hover { background: rgba(255,255,255,0.15) !important; transform: translateY(-1px); }
.story-view-reply-icon .ig-icon, .story-view-reply-send .ig-icon { width: 26px; height: 26px; }
.story-view-reply-icon.is-active .ig-heart { fill: #ff3040 !important; stroke: #ff3040 !important; animation: igHeartPop .32s ease; }
@keyframes igHeartPop { 0% { transform: scale(.7); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
.ig-like-count { color: #fff; font-size: 0.72rem; font-weight: 700; margin-inline-start: 2px; }
.story-view-reply-send .ig-icon { transform: scaleX(-1); }

/* hold-to-pause: hide the chrome like Instagram while finger is held */
#story-view-modal.is-paused .story-view-header,
#story-view-modal.is-paused .story-view-replybar,
#story-view-modal.is-paused .story-progress-track { opacity: 0; }

/* nav zones a touch wider for comfortable tapping */
.story-nav-zone { width: 34%; }

/* ---------- 19. MOBILE REDESIGN (phones only — desktop untouched) ---------- */
@media (max-width: 640px) {
    /* topbar */
    .tg-topbar, .header {
        padding: 8px 10px !important;
        min-height: 56px;
    }
    .tg-title { font-size: 0.98rem; }
    .tg-subtitle { font-size: 0.72rem; }
    .tg-chat-info .tg-avatar { width: 40px; height: 40px; }

    /* sidebar drawer — full, comfortable */
    .tg-sidebar {
        width: min(88vw, 360px) !important;
        min-width: 0 !important;
        box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    }

    /* message bubbles */
    .message { max-width: 84% !important; font-size: 0.95rem; border-radius: 16px !important; }
    .user-message { border-bottom-left-radius: 5px !important; }
    .other-message { border-bottom-right-radius: 5px !important; }

    /* mobile composer pill */
    .tg-ios-composer { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)) !important; gap: 8px; }
    .mobile-input-pill { border-radius: 22px !important; }
    .mobile-floating-input { font-size: 16px !important; } /* avoids iOS zoom */
    .mobile-icon-btn { width: 42px !important; height: 42px !important; }
    .ios-send-btn.btn-send, .mobile-icon-btn.btn-send { box-shadow: var(--pro-glow) !important; }

    /* modals become clean bottom sheets */
    .modal-overlay { align-items: flex-end !important; }
    .modal-content:not(.story-view-card):not(.stream-center-card) {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 22px 22px 0 0 !important;
        padding: 20px 16px calc(20px + env(safe-area-inset-bottom)) !important;
        transform: translateY(100%);
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-overlay.active .modal-content:not(.story-view-card):not(.stream-center-card) {
        transform: translateY(0);
    }
    /* little grabber handle on sheets */
    .modal-content:not(.story-view-card):not(.stream-center-card) .preview-header {
        position: relative;
    }
    .modal-content:not(.story-view-card):not(.stream-center-card)::after {
        content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
        width: 42px; height: 4px; border-radius: 99px; background: var(--pro-glass-border);
    }

    /* story strip a bit tighter */
    .story-strip { gap: 12px; padding: 10px 12px !important; }
    .story-item, .story-create-btn { width: 62px; min-width: 62px; }
    .story-item .story-ring { width: 58px; height: 58px; }
    .story-create-btn::before { width: 58px; height: 58px; }

    /* story viewer truly fullscreen */
    .story-view-card {
        width: 100vw !important;
        height: 100dvh !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
    }
    #story-view-image, #story-view-video, .story-view-text { min-height: 100dvh !important; }

    /* live theater comment bar respects safe area (already glass) */
    .theater-comment-bar { padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important; }

    /* emoji picker fits screen */
    .emoji-picker { max-width: calc(100vw - 20px) !important; }
}

/* ---------- 20. STORY CREATE BUTTON — clean "+" logo, no mismatched frame ---------- */
#story-strip #story-create-btn {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    min-height: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 68px;
    min-width: 68px;
    font-size: 0 !important;           /* hide inline "+ استوری" text */
    letter-spacing: normal !important;
}
#story-strip #story-create-btn::before {
    content: "";
    width: 60px; height: 60px;
    border-radius: 50%;
    background:
        center / 42% no-repeat
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E"),
        linear-gradient(135deg, #47c2ff 0%, #2a8cf0 60%, #2f6ff0 100%);
    box-shadow: 0 8px 22px rgba(42, 140, 240, 0.45);
    border: 0;
}
#story-strip #story-create-btn::after {
    content: "استوری شما";
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--tg-text-secondary);
}
#story-strip #story-create-btn:hover::before { transform: translateY(-1px) scale(1.04); }
/* avatar ring gap blends with the backdrop instead of a hard line */
#story-strip .story-item .story-avatar { border: 3px solid var(--tg-bg) !important; }
body.light-mode #story-strip .story-item .story-avatar { border-color: #eef3fa !important; }

/* ---------- 21. STORY COMPOSER — rebuilt: clean single-column, Instagram-like ---------- */
#story-create-modal .modal-content.story-compose-card {
    width: min(460px, 96vw) !important;
    max-width: 460px !important;
    height: min(92vh, 840px) !important;
    background: #0c131d !important;
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 22px !important;
    overflow: hidden;
}
#story-create-modal .story-compose-header {
    background: rgba(255,255,255,0.04) !important;
    border-bottom: 1px solid var(--pro-glass-border) !important;
}
/* single-column body (kills the cramped 2-column grid) */
#story-create-modal .story-compose-body {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 12px !important;
    padding: 14px !important;
    overflow-y: auto;
    overscroll-behavior: contain;
}
/* undo grid placement / sticky preview on every child */
#story-create-modal .story-create-preview,
#story-create-modal .story-create-modes,
#story-create-modal .story-mode-note,
#story-create-modal .story-compose-top-actions,
#story-create-modal .story-slide-strip,
#story-create-modal .story-compose-input,
#story-create-modal .story-tools-toggle,
#story-create-modal .story-editor-panel {
    grid-column: auto !important;
    grid-row: auto !important;
    position: static !important;
}
/* hero preview: portrait, centered, capped so controls stay visible */
#story-create-modal .story-create-preview {
    width: auto !important;
    height: 44vh !important;
    aspect-ratio: 9 / 16 !important;
    max-width: 100% !important;
    align-self: center !important;
    margin: 0 auto !important;
    border-radius: 18px !important;
    border: 1px solid var(--pro-glass-border) !important;
    box-shadow: 0 16px 36px rgba(0,0,0,0.5) !important;
    overflow: hidden;
}
#story-create-modal .story-create-preview::before { display: none !important; } /* drop faux progress bar */
/* clean stage — remove the diagonal stripe pattern */
#story-create-modal .story-preview-stage {
    background: #05070c !important;
}
body.light-mode #story-create-modal .story-preview-stage { background: #0a0f18 !important; }
/* mode chips: horizontal scroller */
#story-create-modal .story-create-modes {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
#story-create-modal .story-create-modes::-webkit-scrollbar { display: none; }
#story-create-modal .story-create-modes .story-mode-btn {
    flex: 0 0 auto;
    min-width: 84px;
    min-height: 34px;
    border-radius: 999px;
}
#story-create-modal .story-mode-note {
    align-self: flex-start;
    border-radius: 999px;
}
/* primary actions: comfortable wrapping pills */
#story-create-modal .story-compose-top-actions {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
}
#story-create-modal .story-compose-top-actions .link-choice-btn {
    flex: 1 1 132px;
    min-height: 40px;
    border-radius: 12px !important;
    font-size: 0.78rem;
    white-space: nowrap;
}
/* slide thumbnails row */
#story-create-modal .story-slide-strip {
    display: flex !important;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}
#story-create-modal .story-slide-strip::-webkit-scrollbar { display: none; }
/* caption */
#story-create-modal .story-compose-input {
    border-radius: 14px !important;
    min-height: 60px !important;
}
/* pro tools toggle */
#story-create-modal .story-tools-toggle {
    align-self: stretch;
    min-height: 40px;
    border-radius: 12px !important;
}
/* editor panel */
#story-create-modal .story-editor-panel {
    border-radius: 14px !important;
    max-height: 320px;
    overflow: auto;
}
/* footer actions — clear + prominent send */
#story-create-modal .story-compose-actions {
    display: grid !important;
    grid-template-columns: 1fr 1.5fr !important;
    gap: 10px !important;
    position: sticky !important;
    bottom: -14px;
    margin-top: 2px;
    padding: 12px 0 2px !important;
    background: linear-gradient(180deg, rgba(12,19,29,0), #0c131d 40%) !important;
    border: 0 !important;
}
#story-create-modal .story-compose-actions .preview-send-btn {
    background: var(--pro-accent-grad) !important;
    box-shadow: var(--pro-glow) !important;
    border-radius: 12px !important;
    min-height: 44px;
}
#story-create-modal .story-compose-actions .link-choice-btn {
    border-radius: 12px !important;
    min-height: 44px;
}

/* ---------- 22. STORY STRIP EMPTY STATE (no stretch) ---------- */
#story-items { display: flex; align-items: center; gap: 14px; min-width: 0; }
.story-empty-hint {
    font-size: 0.75rem;
    color: var(--tg-text-secondary);
    white-space: nowrap;
    opacity: 0.75;
}

/* ---------- 23. STORY COMPOSER PREVIEW — proper portrait width ---------- */
#story-create-modal .story-create-preview {
    width: min(300px, 82%) !important;
    height: auto !important;
    aspect-ratio: 9 / 16 !important;
    max-height: none !important;
}

/* ---------- 24. LIVE *VIDEO* MESSAGE BUBBLE — fit content (no empty side gap) ---------- */
.message:has(.live-stream-card.stream-kind-video),
.message:has(.live-stream-card.stream-kind-hls) {
    width: -moz-fit-content !important;
    width: fit-content !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    max-width: min(92%, 440px) !important;
    padding: 4px !important;
    background: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
}
.message:has(.live-stream-card.stream-kind-video) .live-stream-card,
.message:has(.live-stream-card.stream-kind-hls) .live-stream-card {
    width: 100% !important;
    max-width: 440px !important;
}
.message:has(.live-stream-card) .message-status { color: var(--tg-text-secondary); }

/* audio-only live streams → a clean, elegant music player (high specificity to beat base css) */
.live-stream-card.stream-kind-audio {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    width: min(280px, 76vw) !important;
    max-width: 300px !important;
    background: linear-gradient(150deg, rgba(55,182,255,0.14), rgba(42,140,240,0.10)) !important;
    border: 1px solid var(--pro-glass-border) !important;
    box-shadow: var(--pro-shadow-sm) !important;
    border-radius: 16px !important;
    padding: 12px !important;
    margin: 2px 0 !important;
}
.live-stream-card.stream-kind-audio::before { display: none !important; }
/* row 1: title + since */
.live-stream-card.stream-kind-audio .live-stream-meta {
    order: 0 !important;
    flex: 0 0 auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}
.live-stream-card.stream-kind-audio .live-stream-title {
    font-size: 0.92rem !important;
    font-weight: 800 !important;
    color: var(--tg-text) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3 !important;
}
.live-stream-card.stream-kind-audio .live-badge,
.live-stream-card.stream-kind-audio .live-msg-broadcast,
.live-stream-card.stream-kind-audio .live-stream-subtitle,
.live-stream-card.stream-kind-audio .stream-status-note,
.live-stream-card.stream-kind-audio .live-stream-actions,
.live-stream-card.stream-kind-audio .live-msg-mute,
.live-stream-card.stream-kind-audio .live-msg-fullscreen,
.live-stream-card.stream-kind-audio .live-msg-minimize { display: none !important; }
.live-stream-card.stream-kind-audio .live-since-chip {
    align-self: flex-start !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    color: var(--tg-text-secondary) !important;
    opacity: 0.9;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
}
.live-stream-card.stream-kind-audio .live-since-dot { width: 7px; height: 7px; }
/* row 2: play button + centered animated waveform */
.live-stream-card.stream-kind-audio .live-stream-hero {
    order: 1 !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
}
.live-stream-card.stream-kind-audio .live-msg-play {
    position: static !important;
    transform: none !important;
    inset: auto !important;
    width: 46px !important;
    height: 46px !important;
    flex: 0 0 auto !important;
    background: var(--pro-accent-grad) !important;
    box-shadow: var(--pro-glow) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}
.live-stream-card.stream-kind-audio .live-msg-visual {
    display: flex !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    align-items: center !important;
    gap: 0 !important;
}
.live-stream-card.stream-kind-audio .live-msg-bars {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex: 1 1 auto !important;
    height: 38px !important;
    gap: 3px !important;
    overflow: visible !important;
}
.live-stream-card.stream-kind-audio .live-msg-bars span {
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 3px !important;
    background: var(--pro-accent-grad) !important;
    border-radius: 999px !important;
    opacity: 0.92;
}
.live-stream-card.stream-kind-audio .live-msg-bars.is-paused span { opacity: 0.4; }

/* video / hls streams: remove the black block behind the title (high specificity) */
.live-stream-card.stream-kind-video .live-stream-meta,
.live-stream-card.stream-kind-hls .live-stream-meta,
.live-stream-card.stream-kind-video.has-video-frame .live-stream-meta,
.live-stream-card.stream-kind-hls.has-video-frame .live-stream-meta {
    background: transparent !important;
}
.live-stream-card.stream-kind-video.has-video-frame .live-stream-meta,
.live-stream-card.stream-kind-hls.has-video-frame .live-stream-meta {
    background: linear-gradient(to top, rgba(0,0,0,0.30), transparent) !important;
}
.live-stream-card.stream-kind-video .live-stream-title,
.live-stream-card.stream-kind-hls .live-stream-title { background: transparent !important; }

/* ---------- 25. "ON AIR SINCE" CHIP on the live card ---------- */
.live-since-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    align-self: flex-start;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #ffd7de;
    background: rgba(255, 55, 95, 0.14);
    border: 1px solid rgba(255, 55, 95, 0.28);
    direction: rtl;
}
.live-since-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #ff375f;
    box-shadow: 0 0 10px #ff375f;
    animation: proOrbPulse 1.4s ease-in-out infinite;
}
body.light-mode .live-since-chip { color: #c81e3a; background: rgba(255,55,95,0.10); }

/* ---------- 26. THEATER TITLE + SINCE + readable comments ---------- */
.theater-title-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.theater-since { font-size: 0.72rem; color: rgba(255,255,255,0.72); display: flex; align-items: center; gap: 6px; }
.theater-since::before {
    content: ""; width: 7px; height: 7px; border-radius: 50%;
    background: #ff375f; box-shadow: 0 0 8px #ff375f;
    animation: proOrbPulse 1.4s ease-in-out infinite;
}
/* name: solid readable colour (no more blue block over the name) */
.theater-comment b {
    color: #6ad4ff !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: currentColor !important;
    font-weight: 800 !important;
    margin-inline-end: 6px;
}
/* send time in the (physical) left corner */
.theater-comment { position: relative; padding-inline-start: 12px; padding-inline-end: 46px; }
.theater-comment-time {
    position: absolute;
    left: 9px;
    bottom: 5px;
    font-size: 0.62rem;
    color: rgba(255,255,255,0.6);
    direction: ltr;
}
/* comments fade out when the mouse isn't around (revealed with the controls) */
.stream-theater .theater-comments {
    opacity: 0.22;
    transition: opacity 0.35s ease;
}
.stream-theater.controls-on .theater-comments,
.stream-theater .theater-comments:hover { opacity: 1; }

/* ---------- 27. MINI-PLAYER (YouTube-style minimize, persists across navigation) ---------- */
.theater-mini-bar { display: none; }
#stream-theater.theater-min {
    inset: auto !important;
    right: 18px !important;
    bottom: 18px !important;
    left: auto !important;
    top: auto !important;
    width: 328px !important;
    height: 196px !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    background: #000 !important;
    box-shadow: 0 22px 55px rgba(0,0,0,0.62) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    cursor: grab;
    touch-action: none;
    z-index: 6000 !important;
}
#stream-theater.theater-min:active { cursor: grabbing; }
#stream-theater.theater-min .theater-topbar,
#stream-theater.theater-min .theater-controls,
#stream-theater.theater-min .theater-comments,
#stream-theater.theater-min .theater-comment-bar,
#stream-theater.theater-min .theater-reactions,
#stream-theater.theater-min #theater-tap { display: none !important; }
#stream-theater.theater-min .theater-mini-bar {
    display: flex !important;
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 5;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.88), rgba(0,0,0,0.05));
}
.theater-mini-btn {
    width: 34px; height: 34px; flex: 0 0 auto;
    display: grid; place-items: center;
    border: 0; border-radius: 10px;
    background: rgba(255,255,255,0.16);
    color: #fff; cursor: pointer;
    transition: background .14s ease, transform .12s ease;
}
.theater-mini-btn:hover { background: rgba(255,255,255,0.28); transform: translateY(-1px); }
.theater-mini-btn svg { width: 18px; height: 18px; }
#theater-mini-play { background: var(--pro-accent-grad); box-shadow: var(--pro-glow); }
.theater-mini-title {
    flex: 1; min-width: 0;
    color: #fff; font-size: 0.82rem; font-weight: 700;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* audio-only mini player: pretty gradient + music glyph instead of black video */
#stream-theater.theater-min.theater-audio { height: 78px !important; width: 300px !important; }
#stream-theater.theater-min.theater-audio .theater-stage {
    background:
        radial-gradient(60% 120% at 15% 0%, rgba(255,255,255,0.18), transparent 60%),
        var(--pro-accent-grad) !important;
}
#stream-theater.theater-min.theater-audio .theater-stage::after {
    content: "";
    position: absolute; inset: 0;
    background: center / 34px no-repeat
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' opacity='0.9'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/svg%3E");
    opacity: 0.5;
}
@media (max-width: 640px) {
    #stream-theater.theater-min { width: min(70vw, 260px) !important; height: min(42vw, 156px) !important; right: 10px !important; bottom: 84px !important; }
    #stream-theater.theater-min.theater-audio { width: min(78vw, 280px) !important; height: 70px !important; }
}

/* ---------- 28. LONG MESSAGE WRAP (fix RTL shift on mobile) ---------- */
.message { min-width: 0; overflow-wrap: anywhere; }
.message-text {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    min-width: 0;
}
.message-text a { word-break: break-all; }

/* ---------- 29. AI MATH ANSWERS (MathJax) + RTL ---------- */
.ai-bot-message .message-text,
.ai-answer {
    direction: rtl;
    text-align: right;
    line-height: 1.9;
}
/* rendered math stays LTR and can scroll horizontally if very wide */
.ai-answer mjx-container { direction: ltr; }
.ai-answer mjx-container[display="true"] {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    margin: 0.5em 0;
    padding-bottom: 2px;
    text-align: center;
}
.ai-answer mjx-container[display="true"]::-webkit-scrollbar { height: 5px; }

/* ---------- 30. STREAM MINI PLACEHOLDER (shown while stream is in the floating player) ---------- */
.live-stream-card.stream-mini-placeholder {
    width: auto !important;
    max-width: 340px !important;
    background: var(--pro-glass-2) !important;
    border: 1px solid var(--pro-glass-border) !important;
    border-radius: 14px !important;
    box-shadow: none !important;
}
.stream-mini-ph-body { display: flex; align-items: center; gap: 9px; padding: 10px 12px; }
.stream-mini-ph-dot {
    width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
    background: #ff375f; box-shadow: 0 0 10px #ff375f;
    animation: proOrbPulse 1.4s ease-in-out infinite;
}
.stream-mini-ph-text { flex: 1; min-width: 0; font-size: 0.82rem; color: var(--tg-text); }
.stream-mini-ph-btn {
    flex: 0 0 auto; border: 0; cursor: pointer;
    padding: 6px 14px; border-radius: 999px;
    background: var(--pro-accent-grad); color: #fff; font-weight: 700; font-size: 0.78rem;
    box-shadow: var(--pro-glow);
}

/* ---------- 31. MINI-PLAYER RESIZE HANDLE ---------- */
.theater-resize { display: none; }
#stream-theater.theater-min .theater-resize {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    z-index: 7;
    cursor: nwse-resize;
    touch-action: none;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.9) 0 2px, transparent 2px) 3px 3px/6px 6px no-repeat,
        linear-gradient(135deg, rgba(255,255,255,0.7) 0 2px, transparent 2px) 7px 7px/6px 6px no-repeat;
    border-top-left-radius: 16px;
}
#stream-theater.theater-min .theater-resize::before {
    content: "";
    position: absolute; top: 4px; left: 4px;
    width: 12px; height: 12px;
    border-top: 2px solid rgba(255,255,255,0.85);
    border-left: 2px solid rgba(255,255,255,0.85);
    border-top-left-radius: 6px;
}

/* ---------- 32. CARD "MINIMIZE" BUTTON (video streams) ---------- */
.live-msg-minimize {
    position: absolute;
    inset-inline-start: auto;
    inset-inline-end: 12px;      /* گوشه‌ی سمت چپ (در حالت راست‌به‌چپ) */
    bottom: 12px;
    z-index: 4;
    width: 40px; height: 40px;
    border: 0; border-radius: 50%;
    display: none; place-items: center;
    color: #fff;
    background: rgba(9, 20, 31, 0.72);
    cursor: pointer;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: opacity 0.22s ease;
}
.live-stream-card.has-video-frame .live-msg-minimize { display: grid; }
.live-msg-minimize svg { width: 20px; height: 20px; }
.live-stream-card.has-video-frame.is-playing:not(.controls-visible) .live-msg-minimize {
    opacity: 0; pointer-events: none;
}
/* audio streams don't need it (play already routes to the floating now-playing player) */
.stream-kind-audio .live-msg-minimize { display: none !important; }

/* ---------- 33. AI CHAT PAGES — light-mode polish (dark already good) ---------- */
/* header stays a clean light glass panel instead of a dark accent block */
body.light-mode.ostad-chat-active .tg-chat-info,
body.light-mode.ai-chat-active .tg-chat-info {
    background: rgba(255, 255, 255, 0.72) !important;
    border: 1px solid var(--pro-glass-border) !important;
    box-shadow: var(--pro-shadow-sm) !important;
}
body.light-mode.ai-chat-active #tg-status { color: #2b57c6 !important; }
body.light-mode.ostad-chat-active #tg-status { color: #b06a10 !important; }
/* remove the heavy colored glow on the composer in light mode */
body.light-mode.ostad-chat-active .desktop-input-row,
body.light-mode.ostad-chat-active .mobile-input-pill,
body.light-mode.ai-chat-active .desktop-input-row,
body.light-mode.ai-chat-active .mobile-input-pill {
    box-shadow: var(--pro-shadow-sm) !important;
}
/* bot bubble: soft readable card with dark text */
body.light-mode .message.ai-bot-message {
    color: #14204a !important;
}
body.light-mode.ai-chat-active .message.ai-bot-message {
    background: linear-gradient(145deg, #eef4ff, #f3eeff) !important;
    border-color: rgba(80, 120, 220, 0.22) !important;
    box-shadow: 0 8px 18px rgba(57, 103, 182, 0.10) !important;
}
body.light-mode .message.ai-bot-message .ai-answer,
body.light-mode .message.ai-bot-message .message-text { color: #14204a !important; }
/* rendered math must be dark on the light bubble */
body.light-mode .ai-answer mjx-container { color: #14204a !important; }
body.light-mode.ostad-chat-active .message.ai-bot-message .ai-answer { color: #3a2408 !important; }
body.light-mode.ostad-chat-active .ai-answer mjx-container { color: #3a2408 !important; }

/* ---------- 34. MULTI-LINE COMPOSER (textarea, Telegram-like) ---------- */
textarea.desktop-input,
textarea.mobile-floating-input {
    resize: none !important;
    overflow-y: auto;
    line-height: 1.5;
    min-height: 0;
    max-height: 132px;
    font-family: inherit;
    scrollbar-width: thin;
    display: block;
}
textarea.desktop-input { padding-top: 11px !important; padding-bottom: 11px !important; }
.desktop-input-row { align-items: flex-end !important; }
.mobile-input-pill { align-items: flex-end; }

/* ---------- 35. TEXT FORMATTING IN MESSAGES (bold / italic / mono / spoiler) ---------- */
.message-text b, .message-text strong { font-weight: 800; }
.message-text i, .message-text em { font-style: italic; }
.tg-mono {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    background: rgba(127, 127, 127, 0.18);
    padding: 1px 6px;
    border-radius: 6px;
    font-size: 0.92em;
    direction: ltr;
    unicode-bidi: embed;
}
.tg-spoiler {
    background: rgba(120, 130, 145, 0.42);
    color: transparent !important;
    border-radius: 5px;
    padding: 0 3px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    transition: color 0.25s ease, background 0.25s ease;
}
.tg-spoiler * { color: transparent !important; }
.tg-spoiler::selection { background: transparent; }
.tg-spoiler.revealed {
    background: rgba(127, 127, 127, 0.12);
    color: inherit !important;
    cursor: text;
    -webkit-user-select: text;
    user-select: text;
}
.tg-spoiler.revealed * { color: inherit !important; }

/* ---------- 36. Telegram-blue text selection ---------- */
::selection { background: rgba(51, 144, 236, 0.40); color: inherit; }
.message-text ::selection, .desktop-input::selection, .mobile-floating-input::selection {
    background: rgba(51, 144, 236, 0.45);
}

/* ---------- 37. MOBILE MESSAGE ALIGNMENT (fix own-messages drifting) ---------- */
@media (max-width: 640px) {
    #chat-messages .user-message {
        align-self: flex-end !important;
        margin: 0 0 8px 0 !important;
        max-width: 82% !important;
    }
    #chat-messages .other-message {
        align-self: flex-start !important;
        margin: 0 0 8px 0 !important;
        max-width: 82% !important;
    }
}

/* ---------- 38. COMPOSER GROWS SMOOTHLY (multi-line, never overflows) ---------- */
.input-area-wrapper { height: auto !important; }
.desktop-input-row {
    align-items: flex-end !important;
    height: auto !important;
    min-height: 0 !important;
}
textarea.desktop-input {
    height: auto;
    min-height: 44px;
    max-height: 132px !important;
    overflow-y: auto !important;
    line-height: 1.5 !important;
    scrollbar-width: thin;
}
.mobile-input-pill {
    height: auto !important;
    min-height: 0 !important;
    align-items: flex-end;
}
textarea.mobile-floating-input {
    height: auto;
    min-height: 22px;
    max-height: 118px !important;
    overflow-y: auto !important;
    line-height: 1.45 !important;
    scrollbar-width: thin;
}

/* ---------- 39. TEXT FORMAT TOOLBAR (Telegram-like, on the composer) ---------- */
.format-toolbar {
    position: fixed;
    z-index: 6200;
    display: none;
    transform: translate(-50%, -100%);
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 12px;
    background: var(--pro-glass-strong);
    -webkit-backdrop-filter: var(--pro-blur);
    backdrop-filter: var(--pro-blur);
    border: 1px solid var(--pro-glass-border);
    box-shadow: var(--pro-shadow-md);
}
.format-toolbar.visible { display: flex; animation: proCommentIn .16s ease; }
.format-toolbar button {
    min-width: 36px;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--tg-text);
    cursor: pointer;
    font-size: 0.92rem;
    display: grid;
    place-items: center;
    padding: 0 8px;
    transition: background .14s ease, color .14s ease;
}
.format-toolbar button:hover { background: var(--tg-hover); color: var(--pro-accent-1); }
.format-toolbar button i { font-style: italic; }
.format-toolbar button b { font-weight: 800; }

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* =====================================================================
   PRO LAYER v2 — (۱) نوار شیشه‌ای پخش زنده صوتی
                  (۲) بازطراحی مودال ساخت استوری (دسکتاپ + موبایل)
                  (۳) نسخه‌ی موبایلِ پاپ‌آپ پخش زنده
   این بخش آخرین لایه‌ی CSS است و بعد از همه‌ی قوانین قبلی اعمال می‌شود.
   ===================================================================== */

/* ---------------------------------------------------------------------
   ۱) AUDIO DOCK — نوار شیشه‌ای پخش زنده صوتی
   --------------------------------------------------------------------- */
.audio-dock {
    position: fixed;
    z-index: 2147480000;
    left: 50%;
    bottom: 16px;
    transform: translate(-50%, 140%);
    width: min(680px, calc(100vw - 24px));
    border-radius: 18px;
    background: var(--pro-glass-strong, rgba(20, 30, 43, 0.8));
    border: 1px solid var(--pro-glass-border, rgba(255, 255, 255, 0.1));
    box-shadow:
        0 18px 50px rgba(3, 9, 18, 0.55),
        0 2px 0 rgba(255, 255, 255, 0.06) inset;
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    backdrop-filter: saturate(180%) blur(22px);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    overflow: hidden;
    transition: transform .42s cubic-bezier(.22, 1, .36, 1), opacity .3s ease, visibility .3s;
}
.audio-dock.active {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
/* وقتی پاپ‌آپ پخش زنده باز است نوار پنهان می‌شود (کنترل تکراری نباشد) */
body:has(#stream-center-modal.active) .audio-dock,
body.theater-open .audio-dock { opacity: 0; pointer-events: none; transform: translate(-50%, 140%); }

.audio-dock .ad-media { display: none; }

.audio-dock-progress {
    position: absolute; inset-inline: 0; top: 0; height: 2px;
    background: rgba(255, 255, 255, 0.07); overflow: hidden;
}
.audio-dock-progress > i {
    display: block; height: 100%; width: 40%;
    background: var(--pro-accent-grad, linear-gradient(90deg, #47c2ff, #2a8cf0));
    transform: translateX(-100%); opacity: 0;
}
.audio-dock.is-loading .audio-dock-progress > i {
    opacity: 1; animation: adSweep 1.1s ease-in-out infinite;
}
@keyframes adSweep { 0% { transform: translateX(-110%); } 100% { transform: translateX(280%); } }

.audio-dock-inner {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
}
.audio-dock .ad-btn {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary, #eef4fb);
    cursor: pointer;
    transition: background .18s ease, transform .18s ease, border-color .18s ease;
}
.audio-dock .ad-btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.audio-dock .ad-btn:active { transform: translateY(0) scale(.96); }
.audio-dock .ad-btn svg { width: 19px; height: 19px; }
.audio-dock .ad-play {
    width: 44px; height: 44px; border-radius: 14px;
    background: var(--pro-accent-grad, linear-gradient(135deg, #47c2ff, #2a8cf0));
    border-color: transparent; color: #fff;
    box-shadow: 0 6px 20px rgba(42, 140, 240, 0.4);
}
.audio-dock .ad-play:hover { filter: brightness(1.08); }
.audio-dock .ad-close:hover { background: rgba(255, 90, 90, 0.22); border-color: rgba(255, 90, 90, 0.4); }

.audio-dock .ad-art {
    flex: 0 0 auto; position: relative;
    width: 42px; height: 42px; border-radius: 13px;
    display: grid; place-items: center;
    color: #cfe8ff;
    background: linear-gradient(140deg, rgba(71, 194, 255, 0.24), rgba(42, 140, 240, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}
.audio-dock .ad-art svg { width: 20px; height: 20px; position: relative; z-index: 1; }
.audio-dock .ad-art-glow {
    position: absolute; inset: -40%;
    background: conic-gradient(from 0deg, rgba(71,194,255,.0), rgba(71,194,255,.55), rgba(71,194,255,.0));
    opacity: 0; transition: opacity .3s ease;
}
.audio-dock.is-playing .ad-art-glow { opacity: .55; animation: adSpin 4.5s linear infinite; }
@keyframes adSpin { to { transform: rotate(360deg); } }

.audio-dock .ad-meta {
    flex: 1 1 auto; min-width: 0;
    display: flex; flex-direction: column; gap: 3px;
}
.audio-dock .ad-title {
    font-size: 13.5px; font-weight: 700; color: var(--text-primary, #eef4fb);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.audio-dock .ad-sub {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; color: var(--text-secondary, #93a6bd);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.audio-dock .ad-live-dot {
    width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto;
    background: #ff4d6a; box-shadow: 0 0 0 0 rgba(255, 77, 106, .6);
}
.audio-dock.is-playing .ad-live-dot { animation: adPulse 1.6s ease-out infinite; }
.audio-dock.has-error .ad-live-dot { background: #d29922; animation: none; }
@keyframes adPulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 77, 106, .55); }
    70% { box-shadow: 0 0 0 8px rgba(255, 77, 106, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 77, 106, 0); }
}

.audio-dock .ad-eq {
    flex: 0 0 auto;
    display: flex; align-items: flex-end; gap: 2.5px;
    height: 26px; padding: 0 4px;
}
.audio-dock .ad-eq > span {
    width: 3px; border-radius: 2px; height: 6px;
    background: linear-gradient(180deg, #6ad4ff, #2a8cf0);
    opacity: .45; transition: opacity .3s ease;
}
.audio-dock.is-playing .ad-eq > span { opacity: 1; animation: adBar .9s ease-in-out infinite; }
.audio-dock .ad-eq > span:nth-child(1) { animation-delay: -.05s; }
.audio-dock .ad-eq > span:nth-child(2) { animation-delay: -.35s; }
.audio-dock .ad-eq > span:nth-child(3) { animation-delay: -.62s; }
.audio-dock .ad-eq > span:nth-child(4) { animation-delay: -.18s; }
.audio-dock .ad-eq > span:nth-child(5) { animation-delay: -.48s; }
.audio-dock .ad-eq > span:nth-child(6) { animation-delay: -.72s; }
.audio-dock .ad-eq > span:nth-child(7) { animation-delay: -.12s; }
.audio-dock .ad-eq > span:nth-child(8) { animation-delay: -.55s; }
.audio-dock .ad-eq > span:nth-child(9) { animation-delay: -.28s; }
.audio-dock .ad-eq > span:nth-child(10) { animation-delay: -.66s; }
.audio-dock .ad-eq > span:nth-child(11) { animation-delay: -.4s; }
.audio-dock .ad-eq > span:nth-child(12) { animation-delay: -.22s; }
.audio-dock .ad-eq > span:nth-child(13) { animation-delay: -.58s; }
.audio-dock .ad-eq > span:nth-child(14) { animation-delay: -.08s; }
@keyframes adBar {
    0%, 100% { height: 5px; }
    50% { height: 22px; }
}

.audio-dock .ad-vol { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.audio-dock .ad-range {
    -webkit-appearance: none; appearance: none;
    width: 92px; height: 4px; border-radius: 99px; outline: none;
    background: rgba(255, 255, 255, 0.16); cursor: pointer;
}
.audio-dock .ad-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 13px; height: 13px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); cursor: pointer;
}
.audio-dock .ad-range::-moz-range-thumb {
    width: 13px; height: 13px; border: 0; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .45); cursor: pointer;
}
.audio-dock.is-pinged { animation: adPing .65s ease; }
@keyframes adPing { 0%, 100% { transform: translate(-50%, 0); } 40% { transform: translate(-50%, -8px); } }

body.light-mode .audio-dock {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(15, 30, 50, 0.1);
    box-shadow: 0 18px 46px rgba(20, 40, 70, 0.18);
}
body.light-mode .audio-dock .ad-btn {
    background: rgba(15, 30, 50, 0.05);
    border-color: rgba(15, 30, 50, 0.1);
    color: #17202b;
}
body.light-mode .audio-dock .ad-play { color: #fff; }
body.light-mode .audio-dock .ad-range { background: rgba(15, 30, 50, 0.14); }

/* حالتِ کارتِ چت وقتی پخش به نوار سپرده شده */
.live-stream-card.is-docked .live-msg-visual { opacity: .55; }
.live-stream-card.is-docked .live-stream-subtitle::after {
    content: ' • در نوار پایین';
    color: var(--pro-accent-1, #37b6ff);
    font-weight: 600;
}

/* موبایل: نوار تمام‌عرض و چسبیده به پایین، بالای نوار ناوبری */
@media (max-width: 640px) {
    .audio-dock {
        left: 8px; right: 8px; width: auto; transform: translate(0, 140%);
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        border-radius: 16px;
    }
    .audio-dock.active { transform: translate(0, 0); }
    body:has(#stream-center-modal.active) .audio-dock,
    body.theater-open .audio-dock { transform: translate(0, 140%); }
    .audio-dock.is-pinged { animation: none; }
    .audio-dock-inner { gap: 8px; padding: 11px 10px; align-items: center; }
    .audio-dock .ad-meta { gap: 4px; }
    .audio-dock .ad-title { line-height: 1.5; }
    .audio-dock .ad-sub { line-height: 1.7; font-size: 11px; }
    .audio-dock .ad-eq { display: none; }
    .audio-dock .ad-vol .ad-range { display: none; }
    .audio-dock .ad-art { width: 38px; height: 38px; border-radius: 11px; }
    .audio-dock .ad-play { width: 40px; height: 40px; }
    .audio-dock .ad-btn { width: 34px; height: 34px; }
    .audio-dock .ad-title { font-size: 13px; }
}
@media (max-width: 380px) {
    .audio-dock .ad-goto { display: none !important; }
}

/* ---------------------------------------------------------------------
   ۲) مودال ساخت استوری — بازطراحی دسکتاپ + موبایل
   با پیشوند `html body` نوشته شده تا بدون جنگِ specificity روی همه‌ی
   قوانینِ قبلی بنشیند.
   --------------------------------------------------------------------- */
html body #story-create-modal.modal-overlay {
    padding: 0 !important;
    align-items: center !important;
    justify-content: center !important;
}
html body #story-create-modal .modal-content.story-compose-card {
    width: min(1060px, calc(100vw - 40px)) !important;
    max-width: min(1060px, calc(100vw - 40px)) !important;
    height: min(92vh, 880px) !important;
    max-height: 92vh !important;
    border-radius: 24px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background:
        radial-gradient(760px 360px at 12% -14%, rgba(71, 194, 255, .15), transparent 62%),
        var(--pro-glass-strong, rgba(20, 30, 43, .9)) !important;
    border: 1px solid var(--pro-glass-border, rgba(255, 255, 255, .1)) !important;
    -webkit-backdrop-filter: saturate(170%) blur(22px);
    backdrop-filter: saturate(170%) blur(22px);
    box-shadow: 0 30px 80px rgba(3, 9, 18, .6) !important;
}
html body #story-create-modal .story-compose-header {
    flex: 0 0 auto !important;
    padding: 14px 20px !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: rgba(255, 255, 255, .04) !important;
}
html body #story-create-modal .story-compose-header h3 { font-size: 15.5px !important; font-weight: 700 !important; }

/* --- بدنه: دو ستون، ستونِ پیش‌نمایش چسبان، کلِ بدنه اسکرول می‌شود --- */
html body #story-create-modal .story-compose-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: clamp(230px, 27vw, 320px) minmax(0, 1fr) !important;
    grid-template-rows: repeat(8, min-content) 1fr !important;
    gap: 10px 20px !important;
    padding: 16px 20px 18px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
html body #story-create-modal .story-compose-body::-webkit-scrollbar { width: 8px; }
html body #story-create-modal .story-compose-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 99px; }

/* ستونِ راست (پیش‌نمایش) — چسبان و همیشه در دید */
html body #story-create-modal .story-create-preview {
    grid-column: 1 !important;
    grid-row: 1 / -1 !important;
    position: sticky !important;
    top: 0 !important;
    align-self: start !important;
    width: 100% !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 9 / 16 !important;
    max-height: min(62vh, 560px) !important;
    border-radius: 22px !important;
    border: 1px solid rgba(255, 255, 255, .16) !important;
    background: #000 !important;
    box-shadow: 0 22px 50px rgba(0, 0, 0, .5) !important;
    overflow: hidden !important;
}
html body #story-create-modal .story-preview-stage {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    border-radius: 0 !important;
    border: 0 !important;
    position: relative !important;
    overflow: hidden !important;
}

/* هر چیزِ دیگری در ستونِ چپ جریان پیدا می‌کند */
html body #story-create-modal .story-compose-body > *:not(.story-create-preview) {
    float: none !important;
    margin: 0 !important;
    grid-column: 2 !important;
    grid-row: auto !important;
    align-self: start !important;
}
html body #story-create-modal .story-create-modes {
    display: flex !important;
    align-items: center !important;
    min-height: 52px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 8px !important;
    padding: 2px 2px 8px !important;
    scrollbar-width: thin;
}
html body #story-create-modal .story-create-modes::-webkit-scrollbar { height: 4px; }
html body #story-create-modal .story-create-modes::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 99px; }
html body #story-create-modal .story-create-modes .story-mode-btn {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    border-radius: 999px !important;
    padding: 9px 16px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
}
html body #story-create-modal #story-mode-note,
html body #story-create-modal .story-mode-note {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    line-height: 1.7 !important;
    padding: 6px 12px !important;
    border-radius: 999px !important;
    width: -moz-fit-content !important;
    width: fit-content !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    font-size: 11.5px !important;
    color: var(--text-secondary) !important;
    background: rgba(255, 255, 255, .05) !important;
    border: 1px solid var(--border-color) !important;
    margin: 0 !important;
}
html body #story-create-modal .story-compose-top-actions {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(122px, 1fr)) !important;
    gap: 8px !important;
    margin: 0 !important;
}
html body #story-create-modal .story-compose-top-actions .link-choice-btn {
    border-radius: 12px !important;
    font-size: 12.5px !important;
    padding: 10px 12px !important;
    width: 100% !important;
}
html body #story-create-modal #story-dup-slide { display: block !important; }
html body #story-create-modal .story-slide-strip {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding: 2px !important;
    max-height: 76px !important;
}
html body #story-create-modal .story-compose-input {
    border-radius: 14px !important;
    resize: none !important;
    min-height: 64px !important;
    max-height: 120px !important;
    width: 100% !important;
}
html body #story-create-modal .story-tools-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 12px 16px !important;
    border-radius: 14px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    opacity: 1 !important;
    background: rgba(255, 255, 255, .06) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    cursor: pointer;
}
html body #story-create-modal .story-tools-toggle::after {
    content: '⌄'; font-size: 17px; line-height: 1; transition: transform .2s ease;
}
html body #story-create-modal .story-tools-toggle.is-open::after { transform: rotate(180deg); }
html body #story-create-modal .story-editor-panel {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 12px 14px !important;
    border-radius: 18px !important;
    border: 1px solid var(--border-color) !important;
    background: rgba(255, 255, 255, .035) !important;
}
html body #story-create-modal .story-editor-panel.is-collapsed { display: none !important; }
html body #story-create-modal .story-editor-row {
    display: grid !important;
    grid-template-columns: repeat(2, max-content minmax(90px, 1fr)) !important;
    align-items: center !important;
    gap: 10px 10px !important;
    padding: 11px 0 !important;
    margin: 0 !important;
    border-bottom: 1px dashed var(--border-color) !important;
    flex-direction: row !important;
}
html body #story-create-modal .story-editor-row:last-child { border-bottom: 0 !important; }
html body #story-create-modal .story-editor-row > label {
    justify-self: end !important;
    font-size: 11.5px !important;
    color: var(--text-secondary) !important;
    white-space: nowrap !important;
    margin: 0 !important;
}
html body #story-create-modal .story-editor-row > .login-input,
html body #story-create-modal .story-editor-row > input[type="text"],
html body #story-create-modal .story-editor-row > select {
    width: 100% !important; min-width: 0 !important;
    border-radius: 10px !important; font-size: 12.5px !important; padding: 9px 10px !important;
}
html body #story-create-modal .story-editor-row > input[type="range"] { width: 100% !important; margin: 0 !important; }
html body #story-create-modal .story-editor-row > input[type="color"] {
    width: 100% !important; height: 34px !important; border-radius: 10px !important;
    border: 1px solid var(--border-color) !important; background: transparent !important; padding: 2px !important;
}
html body #story-create-modal .story-editor-row > .link-choice-btn {
    border-radius: 10px !important; font-size: 12px !important; padding: 9px 10px !important; width: 100% !important;
}
html body #story-create-modal .story-editor-row > .story-inline-toggle {
    display: inline-flex !important; align-items: center !important; gap: 6px !important;
    font-size: 12px !important; color: var(--text-secondary) !important; margin: 0 !important;
}
html body #story-create-modal .tg-photo-actions.story-compose-actions {
    position: sticky !important;
    bottom: 0 !important;
    z-index: 4 !important;
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
    margin: 6px 0 0 !important;
    padding: 12px 0 !important;
    background: linear-gradient(0deg, rgba(11,20,27,1) 0 72%, rgba(11,20,27,0)) !important;
}
html body #story-create-modal .tg-photo-actions.story-compose-actions #story-create-submit {
    flex: 1 1 auto !important;
    border-radius: 14px !important;
    font-weight: 700 !important;
    padding: 13px 18px !important;
}
html body #story-create-modal .tg-photo-actions.story-compose-actions .link-choice-btn {
    flex: 0 0 auto !important; width: auto !important; border-radius: 14px !important; padding: 13px 18px !important;
}

/* --- موبایل / تبلت باریک: شیت تمام‌صفحه، تک‌ستونی --- */
@media (max-width: 900px) {
    html body #story-create-modal .modal-content.story-compose-card {
        width: 100vw !important; max-width: 100vw !important;
        height: 100dvh !important; max-height: 100dvh !important;
        border-radius: 0 !important; border: 0 !important; margin: 0 !important;
    }
    html body #story-create-modal .story-compose-header {
        padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px !important;
    }
    html body #story-create-modal .story-compose-body {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        padding: 0 14px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    }
    html body #story-create-modal .story-compose-body > * { grid-column: auto !important; }
    html body #story-create-modal .story-create-modes {
        order: 1 !important;
        position: sticky !important; top: 0 !important; z-index: 5 !important;
        margin: 0 !important;
        padding: 12px 0 10px !important;
        background: linear-gradient(180deg, rgba(12,20,30,.98) 70%, rgba(12,20,30,0)) !important;
    }
    html body #story-create-modal .story-mode-note { order: 2 !important; }
    html body #story-create-modal .story-create-preview {
        order: 3 !important;
        position: relative !important; top: auto !important;
        grid-row: auto !important;
        flex: 0 0 auto !important;
        align-self: center !important;
        aspect-ratio: auto !important;
        height: 46vh !important;
        max-height: 46vh !important;
        width: calc(46vh * 9 / 16) !important;
        max-width: min(76vw, 320px) !important;
        border-radius: 20px !important;
    }
    html body #story-create-modal .story-slide-strip { order: 4 !important; max-height: 68px !important; }
    html body #story-create-modal .story-compose-top-actions {
        order: 5 !important;
        grid-template-columns: 1fr 1fr !important;
    }
    html body #story-create-modal .story-compose-top-actions .link-choice-btn {
        padding: 12px 10px !important; font-size: 13px !important; border-radius: 13px !important;
    }
    html body #story-create-modal .story-compose-input { order: 6 !important; }
    html body #story-create-modal .story-tools-toggle { order: 7 !important; padding: 13px 16px !important; font-size: 13.5px !important; }
    html body #story-create-modal .story-editor-panel { order: 8 !important; padding: 12px !important; }
    html body #story-create-modal .story-editor-row {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 7px !important;
        padding: 12px 0 !important;
    }
    html body #story-create-modal .story-editor-row > .link-choice-btn { padding: 11px 10px !important; font-size: 12.5px !important; }
    html body #story-create-modal .tg-photo-actions.story-compose-actions {
        order: 9 !important;
        bottom: 0 !important;
        margin: 4px 0 0 !important;
        padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        border-top: 1px solid var(--border-color) !important;
        background: linear-gradient(0deg, rgba(11,20,27,1) 0 76%, rgba(11,20,27,.9)) !important;
        -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    }
    html body #story-create-modal .tg-photo-actions.story-compose-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr) !important;
        gap: 10px !important;
    }
    html body #story-create-modal .tg-photo-actions.story-compose-actions > * {
        width: auto !important; max-width: 100% !important; min-width: 0 !important;
        justify-self: stretch !important; align-self: stretch !important; margin: 0 !important;
        grid-column: auto !important; grid-row: auto !important;
        flex: initial !important;
    }
    html body #story-create-modal .tg-photo-actions.story-compose-actions #story-create-submit { padding: 14px 12px !important; font-size: 14.5px !important; }
    html body #story-create-modal .tg-photo-actions.story-compose-actions .link-choice-btn { padding: 14px 10px !important; font-size: 13px !important; }
}
@media (max-width: 900px) and (orientation: landscape) {
    html body #story-create-modal .story-create-preview {
        height: 62vh !important; max-height: 62vh !important; width: calc(62vh * 9 / 16) !important;
    }
}
body.light-mode #story-create-modal .modal-content.story-compose-card {
    background: radial-gradient(760px 360px at 12% -14%, rgba(71,194,255,.14), transparent 62%), rgba(255,255,255,.95) !important;
}
body.light-mode #story-create-modal .story-create-modes,
body.light-mode #story-create-modal .story-compose-actions {
    background: linear-gradient(180deg, rgba(255,255,255,.99) 70%, rgba(255,255,255,0)) !important;
}
body.light-mode #story-create-modal .story-compose-actions {
    background: linear-gradient(0deg, rgba(255,255,255,.99) 62%, rgba(255,255,255,0)) !important;
}
body.light-mode #story-create-modal .story-editor-panel { background: rgba(15,30,50,.035) !important; }
body.light-mode #story-create-modal .story-tools-toggle { background: rgba(15,30,50,.05) !important; }

/* ---------------------------------------------------------------------
   ۳) پاپ‌آپ پخش زنده — نسخه‌ی مخصوص موبایل
   --------------------------------------------------------------------- */
@media (max-width: 900px) {
    #stream-center-modal .modal-content.live-room-shell,
    #stream-center-modal .stream-center-card {
        width: 100vw !important; max-width: 100vw !important;
        height: 100dvh !important; max-height: 100dvh !important;
        border-radius: 0 !important; border: 0 !important; margin: 0 !important;
        display: flex !important; flex-direction: column !important;
        overflow: hidden !important;
    }
    #stream-center-modal .live-room-header {
        flex: 0 0 auto !important;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px !important;
        gap: 10px !important;
    }
    #stream-center-modal .live-room-title strong { font-size: 15px !important; }
    #stream-center-modal .live-room-title span { font-size: 11.5px !important; }
    #stream-center-modal .live-room-close {
        padding: 8px 14px !important; border-radius: 12px !important; font-size: 13px !important;
    }
    #stream-center-modal .live-room-body {
        flex: 1 1 auto !important; min-height: 0 !important;
        display: flex !important; flex-direction: column !important;
        gap: 0 !important; padding: 0 !important; overflow: hidden !important;
    }

    /* استیجِ فشرده و چسبان در بالا (کارتِ «در حال پخش») */
    #stream-center-modal .live-room-stage {
        flex: 0 0 auto !important;
        padding: 12px 14px !important;
        border-bottom: 1px solid var(--border-color) !important;
        background: radial-gradient(420px 220px at 50% -40%, rgba(71,194,255,.2), transparent 70%) !important;
    }
    #stream-center-modal .live-stage-card {
        min-height: 0 !important; height: auto !important;
        padding: 12px !important; border-radius: 18px !important;
        display: block !important;
    }
    #stream-center-modal .live-orb { width: 54px !important; height: 54px !important; margin: 0 auto 8px !important; }
    #stream-center-modal .live-orb svg { width: 26px !important; height: 26px !important; }
    #stream-center-modal .live-room-status { font-size: 10.5px !important; letter-spacing: .12em !important; }
    #stream-center-modal .live-room-current {
        font-size: 14.5px !important; font-weight: 700 !important;
        margin: 4px 0 8px !important;
        white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important;
    }
    #stream-center-modal .live-waveform {
        height: 30px !important; gap: 3px !important; margin: 0 auto 10px !important;
    }
    /* روی موبایل کنترل‌ها همیشه دیده می‌شوند (فیدشدنِ خودکار حذف) */
    html body #stream-center-modal .live-room-controls,
    html body #stream-center-modal .live-stage-card .live-room-controls {
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
    }
    html body #stream-center-modal .live-stage-card { cursor: default !important; }
    #stream-center-modal .live-room-controls {
        display: grid !important;
        grid-template-columns: 54px 44px 1fr !important;
        grid-template-areas: "play mute send" "vol vol vol" !important;
        align-items: center !important;
        gap: 8px 10px !important;
    }
    #stream-center-modal .live-room-controls #live-room-play {
        grid-area: play !important; width: 54px !important; height: 54px !important; border-radius: 18px !important;
    }
    #stream-center-modal .live-room-controls .live-room-mute {
        grid-area: mute !important; width: 44px !important; height: 44px !important; border-radius: 14px !important;
    }
    #stream-center-modal .live-room-controls .live-send-stream {
        grid-area: send !important; width: 100% !important;
        padding: 13px 14px !important; border-radius: 14px !important;
        font-size: 13.5px !important; font-weight: 700 !important;
    }
    #stream-center-modal .live-volume-wrap {
        grid-area: vol !important; display: flex !important; align-items: center !important; gap: 10px !important;
        width: 100% !important; padding: 2px 2px 0 !important;
    }
    #stream-center-modal .live-volume { flex: 1 1 auto !important; width: auto !important; }

    /* لیست موج‌ها: جستجوی چسبان + اسکرول مستقل */
    #stream-center-modal .live-room-side {
        flex: 1 1 auto !important; min-height: 0 !important;
        display: flex !important; flex-direction: column !important;
        gap: 8px !important;
        padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px)) !important;
        border: 0 !important; background: transparent !important;
        overflow: hidden !important;
    }
    #stream-center-modal #stream-search {
        flex: 0 0 auto !important;
        border-radius: 14px !important; padding: 12px 14px !important; font-size: 13.5px !important;
    }
    #stream-center-modal .live-custom-row {
        flex: 0 0 auto !important;
        display: grid !important; grid-template-columns: minmax(0, 1fr) auto !important; gap: 8px !important;
    }
    #stream-center-modal .live-custom-row .login-input { border-radius: 12px !important; font-size: 12.5px !important; }
    #stream-center-modal .live-custom-row .link-choice-btn { border-radius: 12px !important; padding: 10px 16px !important; }
    #stream-center-modal .stream-result-count { flex: 0 0 auto !important; font-size: 11.5px !important; opacity: .7 !important; }
    #stream-center-modal .stream-list {
        flex: 1 1 auto !important; min-height: 0 !important;
        max-height: none !important; height: auto !important;
        overflow-y: auto !important; -webkit-overflow-scrolling: touch;
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        padding: 2px 2px 4px !important;
        margin: 0 -2px !important;
    }
    #stream-center-modal .stream-list .stream-item {
        display: flex !important; align-items: center !important; gap: 10px !important;
        width: 100% !important; min-height: 54px !important;
        padding: 12px 14px !important;
        border-radius: 14px !important;
        border: 1px solid var(--border-color) !important;
        background: rgba(255, 255, 255, .05) !important;
        font-size: 13.5px !important;
        text-align: right !important;
        transition: background .16s ease, border-color .16s ease, transform .16s ease;
    }
    #stream-center-modal .stream-list .stream-item::before {
        content: ''; flex: 0 0 auto;
        width: 8px; height: 8px; border-radius: 50%;
        background: rgba(255, 255, 255, .22);
        transition: background .16s ease, box-shadow .16s ease;
    }
    #stream-center-modal .stream-list .stream-item.is-active {
        background: var(--pro-accent-soft, rgba(55,182,255,.16)) !important;
        border-color: var(--pro-ring, rgba(55,182,255,.45)) !important;
    }
    #stream-center-modal .stream-list .stream-item.is-active::before {
        background: #ff4d6a; box-shadow: 0 0 0 4px rgba(255, 77, 106, .18);
    }
    #stream-center-modal .stream-list .stream-item:active { transform: scale(.985); }
}
@media (max-width: 900px) and (orientation: landscape) {
    #stream-center-modal .live-room-body { flex-direction: row !important; }
    #stream-center-modal .live-room-stage {
        flex: 0 0 46% !important; border-bottom: 0 !important;
        border-inline-start: 1px solid var(--border-color) !important;
        overflow-y: auto !important;
    }
    #stream-center-modal .live-room-side { flex: 1 1 auto !important; }
}
body.light-mode #stream-center-modal .stream-list .stream-item { background: rgba(15,30,50,.04) !important; }
