/* The orb in the phone bottom bar (≤991px, orb_bar switch, migration 226) and its deck:
 * markup in includes/navigations/mobile_bottombar.php, behaviour in assets/js/sb_orb_deck.js.
 * Colours are sb_theme.css tokens, so it follows Light/Dark/Auto; Watch's player gets a dark,
 * see-through bar (.is-video). Desktop never shows any of it. */

.sbo-scrim, .sbo-deck, .sbo-flick, .sbo-coach, .sbm-orbtn { display: none; }

@media (max-width: 991px) {
    /* ---- the bar, with a notch the orb sits in ------------------------ */
    .sbm-bottombar.has-orb { background: transparent; border-top: 0; overflow: visible; }
    .sbm-bottombar.has-orb::before {
        content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
        background:
            radial-gradient(circle 37px at 50% 0, transparent 35.5px, var(--sb-border) 36px, transparent 37px),
            radial-gradient(circle 36px at 50% 0, transparent 35.5px, var(--sb-surface) 36px);
    }
    .sbm-bottombar.has-orb::after {
        content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; pointer-events: none; background: var(--sb-border);
        -webkit-mask: linear-gradient(90deg, #000 calc(50% - 36px), transparent calc(50% - 36px), transparent calc(50% + 36px), #000 calc(50% + 36px));
        mask: linear-gradient(90deg, #000 calc(50% - 36px), transparent calc(50% - 36px), transparent calc(50% + 36px), #000 calc(50% + 36px));
    }
    html.sbm-bars-hidden .sbm-bottombar.has-orb { transform: translateY(calc(100% + 36px)); }
    .sbm-tab-gap { pointer-events: none; }

    /* Watch's player: dark and see-through, no notch. */
    .sbm-bottombar.is-video { background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .62)); border-top: 0; color: #fff; }
    .sbm-bottombar.is-video::before, .sbm-bottombar.is-video::after { display: none; }
    /* sb_mobile_nav.css sets the tab colours with !important. */
    .sbm-bottombar.is-video .sbm-tab { color: rgba(255, 255, 255, .78) !important; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
    .sbm-bottombar.is-video .sbm-tab.is-active { color: #fff !important; }
    .sbm-bottombar.is-video .sbm-tab.is-active .sbm-tab-avatar { border-color: #fff; }

    /* ---- the orb ---------------------------------------------------- */
    .sbm-orbtn {
        display: block; position: absolute; left: 50%; top: 0; z-index: 2;
        width: 58px; height: 58px; margin: -26px 0 0 -29px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
        background: radial-gradient(circle at 50% 38%, var(--sb-surface), var(--sb-bg));
        box-shadow: 0 6px 18px -6px rgba(80, 60, 200, .5), 0 0 0 1px var(--sb-border);
        touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
        transition: transform .25s cubic-bezier(.2, .9, .3, 1.4), opacity .2s ease, box-shadow .3s ease;
    }
    .sbm-bottombar.is-video .sbm-orbtn {
        background: radial-gradient(circle at 50% 38%, #232634, #101218);
        box-shadow: 0 0 22px -2px rgba(143, 131, 255, .6), 0 0 0 1px rgba(255, 255, 255, .14);
    }
    .sbm-orbtn:focus-visible { outline: 2px solid var(--sb-accent); outline-offset: 3px; }
    .sbm-orbtn.is-pressed { transform: scale(.92); }
    .sbm-orbtn.is-holding { opacity: 0; }
    /* Until sb_dotsphere.js draws its dots (.has-dots) it's the gradient ball. */
    .sbm-orbtn-dots {
        position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; pointer-events: none;
        background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .8) 0 8%, transparent 30%), conic-gradient(#2aa7e0, #6b5cf0, #e8457a, #2aa7e0);
        transition: opacity .25s ease;
    }
    .sbm-orbtn-dots.has-dots { background: none; }
    .sbm-orbtn-dots .sb-dots-canvas { position: absolute; pointer-events: none; }
    .sbm-orbtn-x {
        position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; color: var(--sb-text);
        opacity: 0; transform: rotate(-90deg) scale(.6); transition: opacity .25s ease, transform .28s cubic-bezier(.2, .9, .3, 1.3); pointer-events: none;
    }
    .sbm-bottombar.is-video .sbm-orbtn-x { color: #fff; }
    .sbm-orbtn.open .sbm-orbtn-dots { opacity: .25; }
    .sbm-orbtn.open .sbm-orbtn-x { opacity: 1; transform: none; }
    /* Something for you (a reminder due): a soft ring that breathes, and a dot. */
    .sbm-orbtn.has-news::before {
        content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid rgba(232, 69, 122, .55); pointer-events: none;
        animation: sboNews 2.6s ease-out infinite;
    }
    .sbm-orbtn.has-news::after {
        content: ""; position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; border-radius: 50%;
        background: #e8457a; box-shadow: 0 0 0 2px var(--sb-surface);
    }
    @keyframes sboNews { 0% { transform: scale(.94); opacity: 1; } 100% { transform: scale(1.32); opacity: 0; } }

    /* ---- the deck ---------------------------------------------------- */
    /* Nothing floats over it (the shoutbox button, chat popups, back-to-top). */
    html.sbo-open .shoutbox-widget, html.sbo-open .chat-popup-tray, html.sbo-open #scroll-to-top { visibility: hidden !important; }
    .sbo-scrim {
        display: block; position: fixed; inset: 0; z-index: 1028; background: rgba(8, 10, 22, .42);
        -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); opacity: 0; transition: opacity .28s ease;
    }
    .sbo-scrim[hidden] { display: none; }
    .sbo-scrim.is-open { opacity: 1; }
    .sbo-deck {
        display: grid; gap: 10px; position: fixed; z-index: 1029;
        left: max(8px, env(safe-area-inset-left, 0px)); right: max(8px, env(safe-area-inset-right, 0px));
        bottom: calc(var(--sbm-bottom-h) + var(--sbm-safe-b) + 40px);
        max-width: 520px; margin: 0 auto; max-height: calc(100dvh - var(--sbm-bottom-h) - var(--sbm-safe-b) - 70px); overflow-y: auto; overscroll-behavior: contain;
        padding: 8px 14px 14px; border-radius: 26px; background: var(--sb-surface); color: var(--sb-text);
        box-shadow: 0 -10px 40px -12px rgba(0, 0, 0, .38), 0 0 0 1px var(--sb-border);
        clip-path: circle(0 at var(--sbo-ox, 50%) var(--sbo-oy, 110%));
        transition: clip-path .42s cubic-bezier(.2, .8, .2, 1), transform .2s ease;
    }
    .sbo-deck[hidden] { display: none; }
    .sbo-deck.is-open { clip-path: circle(150% at var(--sbo-ox, 50%) var(--sbo-oy, 110%)); }
    .sbo-deck.is-video {
        --sb-surface: #1a1d27; --sb-bg: #0b0c10; --sb-text: #fff; --sb-text-muted: rgba(255, 255, 255, .58); --sb-border: #2c3142; --sb-hover: #262a37; --sb-input-bg: #12141b;
    }
    .sbo-deck.is-video .sb-chip { background: hsl(var(--h) 35% 22%); color: hsl(var(--h) 85% 74%); }
    .sbo-grab { justify-self: center; width: 38px; height: 4px; border-radius: 4px; background: var(--sb-border); touch-action: none; cursor: grab; }
    .sbo-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
    .sbo-headorb { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; background: conic-gradient(#2aa7e0, #6b5cf0, #e8457a, #2aa7e0); }
    .sbo-headorb.has-dots { background: none; }
    .sbo-headorb .sb-dots-canvas { position: absolute; pointer-events: none; }
    .sbo-hello { display: grid; min-width: 0; line-height: 1.25; }
    .sbo-hello b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sbo-hello span { font-size: 12px; color: var(--sb-text-muted); }
    .sbo-pill { margin-left: auto; flex: none; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--sb-hover); color: var(--sb-text-muted); }
    .sbo-label { margin: 2px 0 0; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-text-muted); }
    .sbo-create { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
    .sbo-tile {
        position: relative; display: grid; justify-items: center; gap: 6px; padding: 11px 2px 9px; border: 0; border-radius: 16px; cursor: pointer;
        background: var(--sb-hover); color: var(--sb-text) !important; text-decoration: none !important; font: inherit; font-size: 12px; font-weight: 700;
        -webkit-tap-highlight-color: transparent; transition: transform .15s ease;
    }
    .sbo-tile:active { transform: scale(.95); }
    .sbo-tile .sb-chip { width: 40px; height: 40px; border-radius: 13px; font-size: 21px; }
    .sbo-tile-label { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sbo-tile.is-here::after { content: "here"; position: absolute; top: 5px; right: 7px; font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #6b5cf0; }
    .sbo-deck.is-video .sbo-tile.is-here::after, body.theme-dark .sbo-tile.is-here::after { color: #a99fff; }
    .sbo-askwrap { display: grid; gap: 8px; }
    .sbo-ask { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 6px; border-radius: 999px; background: var(--sb-input-bg); border: 1px solid var(--sb-border); }
    .sbo-askbox { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 8px 8px; font: inherit; font-size: 14px; color: var(--sb-text-muted); cursor: text; }
    .sbo-ib { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 18px; background: transparent; color: var(--sb-text); cursor: pointer; }
    .sbo-ib.is-go { background: linear-gradient(135deg, #2aa7e0, #6b5cf0 55%, #e8457a); color: #fff; }
    .sbo-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .sbo-chips::-webkit-scrollbar { display: none; }
    .sbo-chip { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--sb-border); background: transparent; color: var(--sb-text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
    .sbo-here { display: grid; gap: 2px; }
    .sbo-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; border-radius: 12px; color: var(--sb-text) !important; text-decoration: none !important; font-size: 14px; font-weight: 600; }
    .sbo-row:active, .sbo-row:hover { background: var(--sb-hover); }
    .sbo-row .sb-chip { width: 30px; height: 30px; border-radius: 10px; font-size: 16px; }
    .sbo-row-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sbo-row > i { color: var(--sb-text-muted); }
    .sbo-foot { margin: 0; font-size: 11.5px; text-align: center; color: var(--sb-text-muted); }
    .sbo-deck.is-open .sbo-in { animation: sboRise .38s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 28ms + 90ms); }
    @keyframes sboRise { from { opacity: 0; transform: translateY(10px); } }

    /* ---- the flick hint and the first-time tip ------------------------- */
    .sbo-flick {
        display: flex; align-items: center; gap: 6px; position: fixed; left: 50%; z-index: 1031; bottom: calc(var(--sbm-bottom-h) + var(--sbm-safe-b) + 48px);
        transform: translateX(-50%); padding: 7px 13px; border-radius: 999px; background: var(--sb-text); color: var(--sb-surface);
        font-size: 13px; font-weight: 700; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s ease, background-color .15s ease;
    }
    .sbo-flick.is-go { background: #6b5cf0; color: #fff; }
    .sbo-coach {
        display: grid; gap: 8px; position: fixed; left: 50%; z-index: 1031; width: min(270px, calc(100vw - 32px));
        bottom: calc(var(--sbm-bottom-h) + var(--sbm-safe-b) + 46px); transform: translateX(-50%);
        padding: 13px 14px; border-radius: 16px; background: #6b5cf0; color: #fff; font-size: 13px; line-height: 1.35;
        box-shadow: 0 12px 30px -10px rgba(60, 40, 180, .6); animation: sboPop .45s cubic-bezier(.2, .9, .3, 1.3) both;
    }
    .sbo-coach[hidden] { display: none; }
    .sbo-coach::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 14px; height: 14px; margin-left: -7px; background: inherit; transform: rotate(45deg); border-radius: 3px; }
    .sbo-coach b { font-size: 14px; }
    .sbo-coach-g { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; font-size: 11.5px; text-align: center; }
    .sbo-coach-g span { background: rgba(255, 255, 255, .16); border-radius: 9px; padding: 6px 2px; }
    .sbo-coach button { justify-self: end; border: 0; border-radius: 9px; padding: 5px 14px; background: #fff; color: #6b5cf0; font: inherit; font-size: 12.5px; font-weight: 800; cursor: pointer; }
    @keyframes sboPop { from { opacity: 0; transform: translate(-50%, 10px) scale(.94); } }

    @media (prefers-reduced-motion: reduce) {
        .sbo-deck, .sbo-scrim, .sbm-orbtn, .sbm-orbtn-x, .sbo-flick { transition: none; }
        .sbo-deck.is-open .sbo-in, .sbo-coach, .sbm-orbtn.has-news::before { animation: none; }
    }
}

/* The composer's picker, shown ready after the orb sent you to the feed (?compose=1&with=video). */
.sbo-ready { border-radius: 14px; animation: sboReady 1.3s ease-in-out 3; }
@keyframes sboReady { 0%, 100% { box-shadow: 0 0 0 0 rgba(107, 92, 240, 0); } 50% { box-shadow: 0 0 0 4px rgba(107, 92, 240, .55); } }
@media (prefers-reduced-motion: reduce) { .sbo-ready { animation: none; box-shadow: 0 0 0 3px rgba(107, 92, 240, .55); } }
