@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@500;600;700;800&display=swap');

/*--------------------------------------------------------------
# LivePix panel on the join screen
--------------------------------------------------------------*/

body {
    --lp-w: 230px;
    --lp-gap: 14px;
    --lp-accent: #ea929e;
    --lp-accent-strong: #c2394f;
    --lp-good: #6fdc9c;
    --lp-bad: #ff8a7a;
    --lp-card: rgba(15, 16, 24, 0.92);
    --lp-border: var(--room-border-strong, rgba(255, 255, 255, 0.14));
    --lp-muted: rgba(241, 241, 244, 0.55);
}

.livepix-panel,
.livepix-chip,
.livepix-feed {
    display: none;
    font-family: 'Montserrat', sans-serif;
}

/* Shift the join dialog left so dialog + panel stay centered together. */
body.livepix-active.livepix-ready:not(.livepix-compact) .swal2-popup.init-modal-size {
    position: relative;
    left: calc((var(--lp-w) + var(--lp-gap)) / -2);
    transition: left 300ms ease;
}

body.livepix-active.livepix-ready .livepix-panel {
    display: flex;
    animation: lpFadeIn 400ms ease both;
}

.livepix-panel {
    position: fixed;
    z-index: 1061;
    box-sizing: border-box;
    width: var(--lp-w);
    flex-direction: column;
    gap: 8px;
    padding: 6px;
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    background: var(--lp-card);
    color: #f1f1f4;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    overflow: hidden;
}

.livepix-panel .lp-close {
    display: none;
}

/*--------------------------------------------------------------
# Top: tagline, link, goal
--------------------------------------------------------------*/

.lp-top {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 8px;
    padding: 10px 8px 10px;
    border-radius: 6px;
    background: linear-gradient(160deg, rgba(194, 57, 79, 0.16), rgba(255, 255, 255, 0.02) 60%);
}

.lp-tagline {
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    text-wrap: balance;
}

.lp-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid rgba(234, 146, 158, 0.35);
    border-radius: 6px;
    background: rgba(234, 146, 158, 0.08);
    color: var(--lp-accent);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 150ms ease, border-color 150ms ease;
}

.lp-link:hover {
    border-color: rgba(234, 146, 158, 0.7);
    background: rgba(234, 146, 158, 0.16);
}

.lp-link i {
    font-size: 0.6rem;
    opacity: 0.8;
}

.lp-goal-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.lp-left,
.lp-target {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.lp-target {
    align-items: flex-end;
    cursor: help;
}

.lp-left-label,
.lp-target-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lp-muted);
}

.lp-left-value {
    display: inline-block;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    transform-origin: left center;
}

.lp-target-value {
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.lp-base {
    color: rgba(241, 241, 244, 0.85);
}

.lp-adjust {
    margin-left: 2px;
    font-size: 0.66rem;
    font-weight: 700;
}

.lp-adjust.lp-good {
    color: var(--lp-good);
}

.lp-adjust.lp-bad {
    color: var(--lp-bad);
}

.lp-bar {
    position: relative;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.lp-bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--lp-accent-strong), var(--lp-accent));
    overflow: hidden;
    transition: width 1500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.lp-reached .lp-bar-fill {
    background: linear-gradient(90deg, #2e9e62, var(--lp-good));
}

.lp-reached .lp-left-label {
    color: var(--lp-good);
}

.lp-goal-sub {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-top: 5px;
    font-size: 0.62rem;
    color: var(--lp-muted);
    font-variant-numeric: tabular-nums;
}

.lp-raised {
    font-weight: 600;
    color: rgba(241, 241, 244, 0.8);
}

.lp-reached .lp-raised {
    color: var(--lp-good);
    font-weight: 700;
}

/*--------------------------------------------------------------
# Supporters list
--------------------------------------------------------------*/

.lp-donors-head {
    padding: 0 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(241, 241, 244, 0.85);
}

.lp-count {
    font-weight: 400;
    color: var(--lp-muted);
}

.lp-donors {
    flex: 1 1 0;
    min-height: 0;
    margin: -4px 0 0;
    padding: 0 4px;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(234, 146, 158, 0.45) transparent;
}

.lp-donors::-webkit-scrollbar {
    width: 6px;
}

.lp-donors::-webkit-scrollbar-track {
    margin: 2px 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
}

.lp-donors::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(234, 146, 158, 0.4);
}

.lp-donors::-webkit-scrollbar-thumb:hover {
    background: rgba(234, 146, 158, 0.75);
}

.lp-donors li {
    box-sizing: border-box;
    height: 38px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.7rem;
}

.lp-donors li:last-child {
    border-bottom: 0;
}

.lp-donor-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: baseline;
    column-gap: 6px;
}

.lp-donor-name {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lp-donor-date {
    font-size: 0.6rem;
    color: rgba(241, 241, 244, 0.45);
    font-variant-numeric: tabular-nums;
}

.lp-donor-amount {
    font-weight: 700;
    color: var(--lp-accent);
    font-variant-numeric: tabular-nums;
}

.lp-donor-msg {
    margin-top: 2px;
    overflow: hidden;
    font-size: 0.62rem;
    font-style: italic;
    color: rgba(241, 241, 244, 0.65);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lp-donor-msg-empty {
    color: rgba(241, 241, 244, 0.2);
    font-style: normal;
}

.lp-donors li.lp-empty {
    height: auto;
    color: var(--lp-muted);
    font-style: italic;
}

/*--------------------------------------------------------------
# Message feed (top-right)
--------------------------------------------------------------*/

body.livepix-active.livepix-ready .livepix-feed {
    display: flex;
}

.livepix-feed {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1061;
    width: min(300px, calc(100vw - 40px));
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    pointer-events: none;
}

.lp-msg {
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(12, 13, 20, 0.55);
    color: #f1f1f4;
    font-size: 0.74rem;
    line-height: 1.35;
    backdrop-filter: blur(4px);
    animation: lpRise 600ms ease both;
    transition: opacity 400ms ease;
}

/* Older messages fade as they move down. */
.lp-msg:nth-child(n + 3) {
    opacity: 0.75;
}
.lp-msg:nth-child(n + 4) {
    opacity: 0.55;
}
.lp-msg:nth-child(n + 5) {
    opacity: 0.35;
}
.lp-msg:nth-child(n + 6) {
    opacity: 0.2;
}

.lp-msg-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
    font-size: 0.68rem;
}

.lp-msg-head strong {
    color: var(--lp-accent);
}

.lp-msg-head span {
    color: rgba(241, 241, 244, 0.6);
    font-variant-numeric: tabular-nums;
}

.lp-msg-text {
    overflow-wrap: anywhere;
}

/*--------------------------------------------------------------
# Compact (narrow screens): chip at the top opens the panel as a sheet
--------------------------------------------------------------*/

body.livepix-active.livepix-ready.livepix-compact .livepix-panel {
    display: none;
}

body.livepix-active.livepix-ready.livepix-compact .livepix-chip {
    position: fixed;
    top: 14px;
    left: 50%;
    z-index: 1061;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--lp-border);
    border-radius: 999px;
    background: var(--lp-card);
    color: #f1f1f4;
    font-size: 0.75rem;
    white-space: nowrap;
    transform: translateX(-50%);
    cursor: pointer;
}

.livepix-chip i {
    color: var(--lp-accent);
}

body.livepix-compact.livepix-sheet-open .livepix-panel {
    display: flex;
    top: 50%;
    left: 50%;
    width: min(300px, calc(100vw - 32px));
    height: min(460px, calc(100vh - 32px));
    padding-top: 38px;
    transform: translate(-50%, -50%);
    z-index: 1070;
}

body.livepix-compact.livepix-sheet-open .livepix-panel .lp-close {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
}

body.livepix-feed-hidden .livepix-feed,
body.livepix-compact .livepix-feed {
    display: none !important;
}

/*--------------------------------------------------------------
# Donation celebration
--------------------------------------------------------------*/

.lp-alert {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px;
    border-radius: 6px;
    background: radial-gradient(circle at 50% 30%, #5a1424 0%, #2a0b14 55%, #12070b 100%);
    box-shadow: inset 0 0 0 1px rgba(234, 146, 158, 0.45);
    color: #fff;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transition: opacity 300ms ease;
}

.lp-alert.show {
    opacity: 1;
    animation: lpAlertIn 600ms cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

.lp-alert::before {
    content: '';
    position: absolute;
    inset: -40%;
    background: conic-gradient(
        from 0deg,
        transparent 0 20%,
        rgba(234, 146, 158, 0.18) 25%,
        transparent 30% 70%,
        rgba(245, 200, 76, 0.14) 75%,
        transparent 80%
    );
    animation: lpSpin 6s linear infinite;
}

.lp-alert > * {
    position: relative;
    max-width: 100%;
}

.lp-alert-icon {
    font-size: 1.6rem;
    color: #ff5d73;
    filter: drop-shadow(0 0 10px rgba(255, 93, 115, 0.7));
}

.lp-alert.show .lp-alert-icon {
    animation: lpBeat 900ms ease-in-out 3;
}

.lp-alert-kicker {
    margin-top: 2px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
}

.lp-alert-name {
    overflow: hidden;
    font-size: 0.95rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lp-alert-amount {
    font-size: 1.45rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(90deg, #f5c84c, #ffe9a8, #f5c84c);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lp-alert.show .lp-alert-amount {
    animation: lpShine 1.6s linear infinite;
}

.lp-alert-msg {
    display: -webkit-box;
    margin-top: 2px;
    overflow: hidden;
    font-size: 0.66rem;
    font-style: italic;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.85);
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.livepix-panel.lp-celebrate {
    animation: lpGlow 2.6s ease-out;
}

.livepix-panel.lp-goal-hit {
    animation: lpGlowGreen 3s ease-out;
}

.lp-left-value.lp-pop {
    animation: lpPop 700ms ease 300ms both;
}

.lp-bar-rising {
    box-shadow: 0 0 14px rgba(234, 146, 158, 0.55);
    transition: box-shadow 400ms ease;
}

.lp-bar-rising .lp-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.75) 50%, transparent 80%);
    background-size: 60% 100%;
    background-repeat: no-repeat;
    animation: lpSweep 1.1s ease-in-out infinite;
}

.lp-donors li.lp-new {
    border-radius: 4px;
    animation: lpRowIn 650ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both, lpRowGlow 3.5s ease 650ms both;
}

.livepix-chip.lp-chip-pop {
    animation: lpChipPop 1.2s ease;
}

.livepix-confetti {
    position: fixed;
    inset: 0;
    z-index: 1066;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/*--------------------------------------------------------------
# Keyframes
--------------------------------------------------------------*/

@keyframes lpFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes lpRise {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }
}

@keyframes lpAlertIn {
    0% {
        opacity: 0;
        transform: scale(0.6) rotate(-4deg);
    }
    60% {
        opacity: 1;
        transform: scale(1.05) rotate(1deg);
    }
    100% {
        transform: scale(1) rotate(0);
    }
}

@keyframes lpSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes lpBeat {
    0%,
    100% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(0.95);
    }
    70% {
        transform: scale(1.15);
    }
}

@keyframes lpShine {
    to {
        background-position: -200% 0;
    }
}

@keyframes lpGlow {
    0%,
    100% {
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(234, 146, 158, 0);
        border-color: var(--lp-border);
    }
    20% {
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(234, 146, 158, 0.9),
            0 0 46px rgba(234, 146, 158, 0.55);
        border-color: rgba(234, 146, 158, 0.9);
    }
}

@keyframes lpGlowGreen {
    0%,
    100% {
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
    }
    25% {
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(111, 220, 156, 0.9),
            0 0 60px rgba(111, 220, 156, 0.55);
    }
}

@keyframes lpPop {
    0%,
    100% {
        transform: scale(1);
    }
    40% {
        transform: scale(1.2);
    }
}

@keyframes lpSweep {
    from {
        background-position: -100% 0;
    }
    to {
        background-position: 250% 0;
    }
}

@keyframes lpRowIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.9);
    }
}

@keyframes lpRowGlow {
    0% {
        background: rgba(234, 146, 158, 0.35);
    }
    100% {
        background: transparent;
    }
}

@keyframes lpChipPop {
    0%,
    100% {
        transform: translateX(-50%) scale(1);
    }
    30% {
        transform: translateX(-50%) scale(1.15);
        box-shadow: 0 0 24px rgba(234, 146, 158, 0.7);
    }
}

@media (prefers-reduced-motion: reduce) {
    .livepix-panel,
    .lp-msg,
    .lp-alert.show,
    .lp-alert::before,
    .lp-donors li.lp-new,
    .lp-bar-rising .lp-bar-fill::after {
        animation: none !important;
    }
}
