/* Live demand — streaming feed (not dashboard boxes) */

.ldb-shell {
    position: relative;
    z-index: 1035;
}

/* ── Slim top ticker ── */
.ldb-ticker {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2rem;
    padding: 0.28rem 0.65rem;
    padding-top: max(0.28rem, env(safe-area-inset-top, 0px));
    background: radial-gradient(ellipse at 20% 50%, rgba(34, 197, 94, 0.14) 0%, transparent 55%),
        linear-gradient(90deg, #0b1220 0%, #111827 50%, #0b1220 100%);
    border-bottom: 1px solid rgba(34, 197, 94, 0.2);
    font-size: 0.7rem;
}

.ldb-ticker__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex: 0 0 auto;
    padding: 0.18rem 0.5rem;
    border: none;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    color: #bbf7d0;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    cursor: pointer;
}

.ldb-live-dot {
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
    animation: ldb-heartbeat 1.4s ease-in-out infinite;
}

@keyframes ldb-heartbeat {
    0%, 100% { transform: scale(1); opacity: 1; }
    14% { transform: scale(1.35); opacity: 0.9; }
    28% { transform: scale(1); opacity: 1; }
    42% { transform: scale(1.2); opacity: 0.95; }
    56% { transform: scale(1); opacity: 1; }
}

.ldb-ticker__track-wrap {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ldb-ticker__track {
    display: flex;
    gap: 1.5rem;
    white-space: nowrap;
    animation: ldb-scroll 35s linear infinite;
}

.ldb-ticker__track:hover {
    animation-play-state: paused;
}

@keyframes ldb-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ldb-ticker__item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #cbd5e1;
    font-size: 0.7rem;
}

.ldb-ticker__word {
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    font-weight: 600;
}

.ldb-ticker__link {
    flex: 0 0 auto;
    color: #4ade80;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.66rem;
}

.ldb-ticker__link:hover {
    color: #86efac;
    text-decoration: none;
}

/* ── Side panel ── */
.ldb-panel {
    position: fixed;
    top: 2rem;
    right: 0;
    width: min(100%, 24rem);
    max-height: calc(100vh - 2rem - env(safe-area-inset-bottom, 0px));
    overflow: auto;
    background: #0b1220;
    border-left: 1px solid rgba(34, 197, 94, 0.2);
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
    z-index: 1045;
    transform: translateX(100%);
    transition: transform 0.24s ease;
    color: #e2e8f0;
}

.ldb-shell.is-open .ldb-panel {
    transform: translateX(0);
}

body.ldb-panel-open {
    overflow: hidden;
}

.ldb-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: #0b1220;
    position: sticky;
    top: 0;
    z-index: 2;
}

.ldb-panel__title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #94a3b8;
}

.ldb-panel__close {
    width: 1.85rem;
    height: 1.85rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    cursor: pointer;
}

.ldb-panel__foot {
    padding: 0.65rem 0.85rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.ldb-panel__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.55rem;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.ldb-panel__link {
    text-align: center;
    font-size: 0.72rem;
    color: #94a3b8;
}

/* ── Live feed core ── */
.ldb-live-feed {
    color: #e2e8f0;
}

.ldb-live-feed__bar {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.65rem 0.75rem;
    align-items: start;
    padding: 0.75rem 0.85rem 0.55rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.06) 0%, transparent 100%);
}

.ldb-live-feed__pulse {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ldb-live-feed__pulse .ldb-live-dot {
    position: relative;
    z-index: 2;
}

.ldb-live-feed__pulse .ldb-pulse-ring__wave {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(34, 197, 94, 0.4);
    animation: ldb-ring 2.4s ease-out infinite;
}

@keyframes ldb-ring {
    0% { transform: scale(0.55); opacity: 0.9; }
    100% { transform: scale(1.35); opacity: 0; }
}

.ldb-live-feed__eyebrow {
    margin: 0;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #4ade80;
}

.ldb-live-feed__campus,
.ldb-pulse-board__campus {
    margin: 0.12rem 0 0;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.25;
    color: #f8fafc;
}

.ldb-live-feed__meta,
.ldb-pulse-board__stat-line {
    margin: 0.25rem 0 0;
    font-size: 0.68rem;
    color: #94a3b8;
}

.ldb-viz {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 3px;
    height: 1.75rem;
    padding: 0.2rem 0;
}

.ldb-viz__bar {
    flex: 1;
    max-width: 8px;
    height: var(--h, 20%);
    min-height: 3px;
    border-radius: 3px 3px 1px 1px;
    background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
    opacity: 0.85;
    transition: height 0.35s ease, opacity 0.35s ease;
    animation: ldb-bar-idle 1.8s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 0.08s);
}

.ldb-viz.is-live .ldb-viz__bar {
    animation: ldb-bar-pulse 0.9s ease-in-out infinite;
    animation-delay: calc(var(--i, 0) * 0.06s);
}

@keyframes ldb-bar-idle {
    0%, 100% { opacity: 0.35; transform: scaleY(0.85); }
    50% { opacity: 0.55; transform: scaleY(1); }
}

@keyframes ldb-bar-pulse {
    0%, 100% { transform: scaleY(0.7); opacity: 0.65; }
    50% { transform: scaleY(1.15); opacity: 1; }
}

/* ── Trending word ribbon (marquee, not a box) ── */
.ldb-live-feed__ribbon-wrap {
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}

.ldb-live-feed__ribbon {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.55rem 0.85rem;
    white-space: nowrap;
    animation: ldb-scroll 40s linear infinite;
}

.ldb-live-feed__ribbon:hover {
    animation-play-state: paused;
}

.ldb-live-feed__ribbon.is-static {
    animation: none;
    flex-wrap: wrap;
    white-space: normal;
    justify-content: center;
}

.ldb-word {
    display: inline-block;
    font-weight: 700;
    line-height: 1.2;
    color: #e2e8f0;
    transition: transform 0.2s ease, color 0.2s ease;
    animation: ldb-word-in 0.45s ease backwards;
}

.ldb-word--xl { font-size: 1.25rem; color: #f8fafc; }
.ldb-word--lg { font-size: 1rem; }
.ldb-word--md { font-size: 0.86rem; }
.ldb-word--sm { font-size: 0.74rem; opacity: 0.9; }
.ldb-word--xs { font-size: 0.64rem; opacity: 0.75; }

.ldb-word--hot {
    color: #fdba74;
    text-shadow: 0 0 12px rgba(246, 139, 30, 0.45);
}

.ldb-word--ghost {
    opacity: 0.28;
    animation: ldb-ghost-float 4s ease-in-out infinite;
}

.ldb-word--ghost:nth-child(2) { animation-delay: 0.5s; }
.ldb-word--ghost:nth-child(3) { animation-delay: 1s; }
.ldb-word--ghost:nth-child(4) { animation-delay: 1.5s; }
.ldb-word--ghost:nth-child(5) { animation-delay: 2s; }

@keyframes ldb-ghost-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes ldb-word-in {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.ldb-word__count {
    font-size: 0.55em;
    font-weight: 800;
    color: #4ade80;
    margin-left: 0.15rem;
    vertical-align: super;
}

/* ── Activity stream (timeline feed) ── */
.ldb-live-feed__stream,
.ldb-tape {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 14rem;
    overflow: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.ldb-feed-row {
    display: grid;
    grid-template-columns: 3.2rem 1fr auto;
    gap: 0.5rem 0.65rem;
    align-items: baseline;
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.78rem;
    animation: ldb-feed-in 0.45s ease;
}

.ldb-feed-row.is-new {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.12) 0%, transparent 70%);
}

.ldb-feed-row--idle {
    opacity: 0.65;
    font-style: italic;
}

.ldb-feed-row--search .ldb-feed-row__verb { color: #60a5fa; }
.ldb-feed-row--post .ldb-feed-row__verb { color: #4ade80; }
.ldb-feed-row--request .ldb-feed-row__verb { color: #fb923c; }
.ldb-feed-row--agent .ldb-feed-row__verb { color: #c084fc; }

@keyframes ldb-feed-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.ldb-feed-row__time {
    font-size: 0.62rem;
    color: #64748b;
    font-variant-numeric: tabular-nums;
    text-transform: lowercase;
}

.ldb-feed-row__body {
    color: #e2e8f0;
    line-height: 1.4;
    min-width: 0;
}

.ldb-feed-row__verb {
    font-weight: 700;
    text-transform: lowercase;
}

.ldb-feed-row__term {
    font-weight: 700;
    color: #f8fafc;
}

.ldb-feed-row__tag {
    flex: 0 0 auto;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    padding: 0.12rem 0.35rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}

/* ── Full page board ── */
.ldb-full {
    margin: 0 0 1rem;
    padding: 0;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(145deg, #0b1220 0%, #111827 45%, #0f172a 100%);
    border: 1px solid rgba(34, 197, 94, 0.22);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.ldb-full .ldb-live-feed__stream {
    max-height: min(52vh, 28rem);
}

.ldb-full .ldb-live-feed__campus {
    font-size: 1.2rem;
}

.ldb-panel .ldb-live-feed__stream {
    max-height: 12rem;
}

.ldb-panel .ldb-live-feed__campus {
    font-size: 0.92rem;
}

/* ── Login gate (guests on demand feed) ── */
.ldb-login-gate {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: linear-gradient(145deg, #0b1220 0%, #111827 100%);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #e2e8f0;
}

.ldb-login-gate__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem 0.85rem;
}

.ldb-login-gate__title {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 800;
    color: #f8fafc;
}

.ldb-login-gate__text {
    margin: 0.15rem 0 0;
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.4;
}

.ldb-login-gate__cta {
    margin-left: auto;
    flex: 0 0 auto;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.ldb-login-gate__cta:hover {
    color: #fff;
    text-decoration: none;
}

/* ── Panel backdrop (mobile) ── */
.ldb-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: rgba(15, 23, 42, 0.55);
    border: none;
    padding: 0;
    cursor: pointer;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ldb-backdrop {
        display: block;
    }

    .ldb-backdrop[hidden] {
        display: none !important;
    }

    .ldb-panel {
        top: auto;
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        max-height: min(88vh, calc(100dvh - env(safe-area-inset-bottom, 0px)));
        border-left: none;
        border-top: 1px solid rgba(34, 197, 94, 0.25);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.35);
    }

    .ldb-shell.is-open .ldb-panel {
        transform: translateY(0);
    }

    .ldb-panel .ldb-live-feed__stream {
        max-height: min(38vh, 16rem);
    }

    .ldb-ticker__link {
        font-size: 0;
        width: 1.75rem;
        height: 1.75rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        background: rgba(34, 197, 94, 0.12);
    }

    .ldb-ticker__link::after {
        content: '→';
        font-size: 0.75rem;
    }

    .ldb-full {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-radius: 12px;
    }

    .ldb-full .ldb-live-feed__stream {
        max-height: min(48vh, 22rem);
    }

    .ldb-login-gate__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .ldb-login-gate__cta {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 640px) {
    .ldb-ticker {
        gap: 0.4rem;
        padding: 0.35rem max(0.5rem, env(safe-area-inset-left, 0px)) 0.35rem max(0.5rem, env(safe-area-inset-right, 0px));
        min-height: 2.35rem;
    }

    .ldb-ticker__toggle {
        font-size: 0;
        padding: 0.35rem 0.45rem;
        gap: 0;
    }

    .ldb-ticker__brand {
        display: none;
    }

    .ldb-live-feed__bar {
        grid-template-columns: auto 1fr;
        gap: 0.5rem 0.65rem;
        padding: 0.65rem 0.75rem 0.5rem;
    }

    .ldb-live-feed__campus {
        font-size: 0.95rem;
    }

    .ldb-live-feed__meta {
        font-size: 0.64rem;
        line-height: 1.35;
    }

    .ldb-viz {
        height: 1.5rem;
    }

    .ldb-live-feed__ribbon {
        padding: 0.45rem 0.75rem;
        gap: 0.65rem;
    }

    .ldb-word--xl { font-size: 1.05rem; }
    .ldb-word--lg { font-size: 0.9rem; }

    .ldb-feed-row {
        grid-template-columns: 2.35rem 1fr;
        gap: 0.35rem 0.5rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.72rem;
    }

    .ldb-feed-row__tag {
        display: none;
    }

    .ldb-feed-row__time {
        font-size: 0.58rem;
    }

    .ldb-panel__foot {
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 380px) {
    .ldb-ticker__track-wrap {
        mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
    }

    .ldb-live-feed__pulse {
        width: 2rem;
        height: 2rem;
    }

    .ldb-live-feed__eyebrow {
        font-size: 0.55rem;
    }
}

@media (min-width: 769px) {
    .ldb-backdrop {
        display: none !important;
    }
}
