/* Campus Pulse — Facebook Stories-style full-bleed rail */
:root {
    --pulse-slate: var(--secondary, #2c3e50);
    --pulse-muted: var(--gray, #64748b);
    --pulse-accent: #f68b1e;
    --pulse-accent-soft: rgba(246, 139, 30, 0.12);
    --pulse-ring-live: linear-gradient(135deg, #1877f2 0%, #e96703 45%, #f68b1e 100%);
    --pulse-ring-seen: #cbd5e1;
    --pulse-tile-w: 8.5rem;
    --pulse-tile-ratio: 4 / 5;
}

.tl-pulse {
    --pulse-pad-x: var(--cp-pad-x, var(--tl-pad-x, 1rem));
    margin-bottom: 0.75rem;
    padding: 0;
}

.tl-pulse__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
    padding: 0 var(--pulse-pad-x);
}

.tl-pulse__head {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.tl-pulse__agent-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    color: var(--pulse-slate);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    white-space: nowrap;
}

.tl-pulse__agent-pill:hover {
    border-color: var(--pulse-accent);
    color: var(--pulse-slate);
}

.tl-pulse__agent-pill i { color: var(--pulse-accent); font-size: 0.8rem; }

.tl-pulse__agent-free {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pulse-muted);
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
}

@media (max-width: 420px) {
    .tl-pulse__agent-text { display: none; }
    .tl-pulse__agent-pill { padding: 0.5rem 0.55rem; }
}

.tl-pulse__title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--pulse-slate);
}

.tl-pulse__title i {
    color: var(--pulse-accent);
    margin-right: 0.2rem;
}

.tl-pulse__sub {
    margin: 0.1rem 0 0;
    font-size: 0.62rem;
    color: var(--pulse-muted);
}

.tl-pulse__promo-count {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.35rem;
    padding: 0.08rem 0.35rem;
    border-radius: 999px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pulse-accent);
    background: var(--pulse-accent-soft);
}

/* Full-bleed carousel */
.tl-pulse__carousel {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-left: calc(-1 * var(--pulse-pad-x));
    margin-right: calc(-1 * var(--pulse-pad-x));
}

.tl-pulse__viewport {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.tl-pulse__nav {
    flex: 0 0 auto;
    align-self: center;
    width: 1.75rem;
    height: 1.75rem;
    margin: 0 0.15rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--pulse-slate);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
    transition: transform 0.15s ease;
}

.tl-pulse__nav:hover {
    transform: scale(1.05);
}

.tl-pulse__nav.is-visible { display: flex; }

@media (min-width: 768px) {
    .tl-pulse__nav { display: flex; }
}

@media (max-width: 767px) {
    .tl-pulse__nav { display: none !important; }
}

.tl-pulse__scroll {
    display: flex;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    touch-action: pan-x;
    -webkit-tap-highlight-color: transparent;
}

.tl-pulse__scroll::-webkit-scrollbar { display: none; }

.tl-pulse__scroll.is-auto-scrolling {
    scroll-behavior: auto;
    scroll-snap-type: none;
}

.tl-pulse__scroll.is-user-scrolling {
    scroll-snap-type: x mandatory;
}

/* Story tile */
.tl-pulse-tile {
    flex: 0 0 auto;
    width: var(--pulse-tile-w);
    scroll-snap-align: start;
    touch-action: pan-x;
}

.tl-pulse-tile__ring {
    padding: 2px;
    border-radius: 14px;
    background: var(--pulse-ring-live);
    height: 100%;
}

.tl-pulse-tile.is-seen .tl-pulse-tile__ring {
    background: var(--pulse-ring-seen);
}

.tl-pulse-tile--spotlight .tl-pulse-tile__ring {
    background: linear-gradient(135deg, #f68b1e 0%, #e96703 50%, #1877f2 100%);
}

.tl-pulse-tile--create .tl-pulse-tile__ring {
    background: linear-gradient(135deg, #1877f2, #60a5fa);
}

.tl-pulse-tile__shell {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    touch-action: pan-x;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.tl-pulse-tile__shell:focus-visible {
    outline: 2px solid var(--pulse-accent);
    outline-offset: 2px;
}

.tl-pulse-tile__shell:active {
    transform: scale(0.985);
}

.tl-pulse-tile.is-seen .tl-pulse-tile__shell {
    opacity: 0.88;
    filter: saturate(0.82);
}

.tl-pulse-tile__badge {
    position: absolute;
    top: 0.35rem;
    left: 0.35rem;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.12rem 0.35rem;
    border-radius: 999px;
    font-size: 0.48rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.tl-pulse-tile__badge--create {
    background: rgba(24, 119, 242, 0.75);
}

.tl-pulse-tile__media {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.tl-pulse-tile__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.tl-pulse-tile__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #334155 0%, #1e293b 100%);
    color: var(--pulse-accent);
    font-size: 1.35rem;
}

.tl-pulse-tile--create .tl-pulse-tile__placeholder {
    background: linear-gradient(160deg, #1d4ed8 0%, #1e3a8a 100%);
    color: #fff;
    font-size: 1.75rem;
}

.tl-pulse-tile__shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0.15) 0%,
        rgba(15, 23, 42, 0) 28%,
        rgba(15, 23, 42, 0) 55%,
        rgba(15, 23, 42, 0.82) 100%
    );
}

.tl-pulse-tile__avatar {
    position: absolute;
    top: 0.45rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    padding: 2px;
    background: #fff;
    box-shadow: 0 1px 6px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tl-pulse-tile__avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.tl-pulse-tile__avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--pulse-accent), #e96703);
    text-transform: uppercase;
}

.tl-pulse-tile__label {
    position: absolute;
    left: 0.4rem;
    right: 0.4rem;
    bottom: 0.42rem;
    z-index: 3;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}

.tl-pulse__empty {
    margin: 0.35rem var(--pulse-pad-x) 0;
    font-size: 0.72rem;
    color: var(--pulse-muted);
}

body.tl-pulse-open { overflow: hidden; }

/* Full-screen viewer (unchanged) */
.tl-pulse-viewer {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    box-sizing: border-box;
}

.tl-pulse-viewer.is-open { display: flex; }

.tl-pulse-viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.92);
    backdrop-filter: blur(2px);
}

.tl-pulse-viewer__stage {
    position: relative;
    width: min(100%, 420px);
    height: min(92vh, 760px);
    z-index: 2;
}

.tl-pulse-viewer__card {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: var(--secondary);
    color: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.tl-pulse-viewer__media {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.tl-pulse-viewer__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tl-pulse-viewer__media img.is-hidden { display: none; }

.tl-pulse-viewer__media-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--pulse-accent);
    background: linear-gradient(160deg, var(--secondary) 0%, var(--secondary) 100%);
}

.tl-pulse-viewer__media-fallback.is-hidden { display: none; }

.tl-pulse-viewer__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(15, 23, 42, 0) 0%,
        rgba(15, 23, 42, 0.08) 50%,
        rgba(15, 23, 42, 0.72) 100%
    );
}

.tl-pulse-viewer__content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.25rem 1.1rem 1.5rem;
    z-index: 5;
}

.tl-pulse-viewer__type {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 0.35rem;
}

.tl-pulse-viewer__title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    line-height: 1.25;
    color: #fff;
}

.tl-pulse-viewer__body {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--unimart-border);
    line-height: 1.45;
}

.tl-pulse-viewer__meta {
    margin: 0 0 0.85rem;
    font-size: 0.72rem;
    color: var(--gray);
}

.tl-pulse-viewer__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tl-pulse-viewer__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    background: var(--pulse-accent);
    color: #fff;
}

.tl-pulse-viewer__cta--agent {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.tl-pulse-viewer__cta.is-hidden,
.tl-pulse-viewer__cta--agent.is-hidden {
    display: none;
}

.tl-pulse-viewer__close {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 10;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.45);
    color: #fff;
    cursor: pointer;
}

.tl-pulse-viewer__progress {
    position: absolute;
    top: 0.45rem;
    left: 0.65rem;
    right: 2.75rem;
    z-index: 10;
    display: flex;
    gap: 4px;
}

.tl-pulse-viewer__seg {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.35);
}

.tl-pulse-viewer__seg.is-active { background: #fff; }

.tl-pulse-viewer__nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 22%;
    z-index: 4;
    border: none;
    background: transparent;
    cursor: pointer;
    touch-action: manipulation;
}

.tl-pulse-viewer__nav--prev { left: 0; }
.tl-pulse-viewer__nav--next { right: 0; }

@media (min-width: 480px) {
    :root { --pulse-tile-w: 7.5rem; }
}

@media (min-width: 768px) {
    :root { --pulse-tile-w: 8.25rem; }
}
