/* _core.css */
/* Core Overlay Styles - Base layout and connection status */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    background: transparent !important;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    height: 100vh;
    width: 100vw;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    color: white;
}

#overlay-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}


/* Goals Container — layout/centering in _goals.css */
#goals-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    pointer-events: none;
}

/* ── SBCanvas API Utilities ────────────────────────────────────── */

/* Shake animation (SBCanvas.shake) */
@keyframes sbcanvas-shake {
    0%, 100% { transform: translate(0, 0); }
    10%      { transform: translate(calc(-1 * var(--shake-intensity, 5px)), 0); }
    20%      { transform: translate(var(--shake-intensity, 5px), calc(-1 * var(--shake-intensity, 5px))); }
    30%      { transform: translate(calc(-1 * var(--shake-intensity, 5px)), var(--shake-intensity, 5px)); }
    40%      { transform: translate(var(--shake-intensity, 5px), var(--shake-intensity, 5px)); }
    50%      { transform: translate(calc(-1 * var(--shake-intensity, 5px)), calc(-1 * var(--shake-intensity, 5px))); }
    60%      { transform: translate(var(--shake-intensity, 5px), 0); }
    70%      { transform: translate(calc(-1 * var(--shake-intensity, 5px)), var(--shake-intensity, 5px)); }
    80%      { transform: translate(calc(-1 * var(--shake-intensity, 5px)), calc(-1 * var(--shake-intensity, 5px))); }
    90%      { transform: translate(var(--shake-intensity, 5px), 0); }
}

/* Toast notification (SBCanvas.toast) */
.sbcanvas-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    font-weight: 500;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 99998;
    pointer-events: none;
    white-space: nowrap;
}

/* _alerts.css */
.alert-container {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    will-change: transform, opacity;
    transform: translate3d(-50%, -50%, 0);
}

.alert-container.visible {
    opacity: 1;
}

.alert-container.top-center {
    top: 10%;
    left: 50%;
    transform: translate3d(-50%, 0, 0);
}

.alert-container.center {
    top: 50%;
    left: 50%;
    transform: translate3d(-50%, -50%, 0);
}

.alert-container.bottom-center {
    bottom: 10%;
    left: 50%;
    transform: translate3d(-50%, 0, 0);
}

.alert-image {
    max-width: 300px;
    max-height: 200px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.alert-video {
    max-width: 400px;
    max-height: 300px;
    margin-bottom: 15px;
    border-radius: 8px;
}

.alert-message {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    max-width: 500px;
    line-height: 1.4;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) translateY(50px);
    }

    to {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) translateY(0);
    }
}

@keyframes slideOutDown {
    from {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) translateY(0);
    }

    to {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) translateY(50px);
    }
}

@keyframes bounce {
    0% {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) scale(0.3);
    }

    50% {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) scale(1.1);
    }

    75% {
        transform: translate3d(-50%, -50%, 0) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) scale(1);
    }
}

@keyframes zoom {
    from {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) scale(0.5);
    }

    to {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) scale(1);
    }
}

@keyframes pop {
    0% {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) scale(0);
    }

    50% {
        transform: translate3d(-50%, -50%, 0) scale(1.2);
    }

    100% {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) scale(1);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) translateX(-60px);
    }

    to {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) translateX(60px);
    }

    to {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) translateX(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) translateY(0);
    }
}

@keyframes flipIn {
    from {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) perspective(400px) rotateY(-90deg);
    }

    to {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) perspective(400px) rotateY(0);
    }
}

@keyframes slideOutUp {
    from {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) translateY(0);
    }

    to {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) translateY(-50px);
    }
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) translateX(0);
    }

    to {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) translateX(-60px);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) translateX(0);
    }

    to {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) translateX(60px);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) scale(1);
    }

    to {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) scale(0.5);
    }
}

@keyframes flipOut {
    from {
        opacity: 1;
        transform: translate3d(-50%, -50%, 0) perspective(400px) rotateY(0);
    }

    to {
        opacity: 0;
        transform: translate3d(-50%, -50%, 0) perspective(400px) rotateY(90deg);
    }
}

/* ── In animations ──────────────────────────────── */

.animate-none {
    /* No animation — just make visible immediately */
    opacity: 1;
}

.animate-fade {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide_up {
    animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide_down {
    animation: slideInDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide_left {
    animation: slideInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide_right {
    animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-bounce {
    animation: bounce 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.animate-zoom {
    animation: zoom 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-pop {
    animation: pop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.animate-flip {
    animation: flipIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Out animations ─────────────────────────────── */

.animate-out-none {
    opacity: 0;
}

.animate-out-fade {
    animation: fadeOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-out-slide_down {
    animation: slideOutDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-out-slide_up {
    animation: slideOutUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-out-slide_left {
    animation: slideOutLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-out-slide_right {
    animation: slideOutRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-out-zoom {
    animation: zoomOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-out-bounce {
    animation: fadeOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-out-pop {
    animation: fadeOut 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-out-flip {
    animation: flipOut 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* _chat.css */
/* Chat Overlay Styles — Original Clean Design */
/* Inline-flex message rows, avatar circles, sticky pin,
   red-flash delete, and event sparkle. */

/* === CUSTOMIZABLE VARIABLES === */
:root {
    --font-family: 'Inter', sans-serif;

    /* Chat Animation */
    --chat-animation-duration: 300ms;

    /* Pinned Message */
    --pin-bg-color: rgba(14, 14, 22, 0.95);

    /* Deleted Message */
    --delete-opacity: 0;
    --delete-duration: 500ms;
}


/* =========================================
   OUTER CONTAINER
   ========================================= */
#chat-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: transparent;
    pointer-events: none;
    /* GPU acceleration */
    transform: translateZ(0);
    backface-visibility: hidden;
}

#chat-container.direction-top_down {
    top: 0;
    bottom: auto;
}

/* =========================================
   MESSAGES — scroll container with hidden
   scrollbar. Auto-scrolled to bottom by JS.
   ========================================= */
#chat-messages {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow-y: auto;
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* IE/Edge */
    padding: 8px;
    gap: 8px;
    box-sizing: border-box;
    /* Contain layout for performance */
    contain: layout style;
}
#chat-messages::-webkit-scrollbar {
    display: none;                  /* Chrome/Safari */
}

/* Spacer pushes messages to bottom when few */
#chat-messages::before {
    content: '';
    flex: 1 0 0px;
}

#chat-container.direction-top_down #chat-messages {
    justify-content: flex-start;
}
#chat-container.direction-top_down #chat-messages::before {
    display: none;
}

/* =========================================
   PINNED — position:sticky keeps the msg
   locked at the top of the visible scroll
   area. Other messages scroll UNDER it.
   ========================================= */
.chat-message.is-pinned {
    position: sticky;
    top: 8px;
    z-index: 10;
    background: var(--pin-bg-color, rgba(14, 14, 22, 0.95));
    transition: background 0.4s ease;
}

/* Unpin: pin indicator fades out, background eases back */
.chat-message.is-unpinning .pin-indicator {
    animation: pinIconOut 0.35s ease forwards;
}

@keyframes pinIconOut {
    0%   { opacity: 1; transform: scale(1) rotate(0deg); }
    100% { opacity: 0; transform: scale(0.3) rotate(-30deg); }
}

.pin-indicator {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.65);
}

.pin-indicator svg {
    width: 13px;
    height: 13px;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.2));
}

/* =========================================
   MESSAGE ROW
   ========================================= */
.chat-message {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    color: #ffffff;
    animation: fadeInMsg 0.3s ease forwards;
    flex-shrink: 0;
    max-width: 100%;

    background: rgba(18, 18, 22, 0.55);
    padding: 5px 10px;
    border-radius: 6px;
}

@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =========================================
   ENTRANCE ANIMATIONS
   ========================================= */
/* Slide up (default) */
.chat-message.animate-slide_up {
    animation: chatSlideUp var(--chat-animation-duration, 300ms) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes chatSlideUp {
    from { opacity: 0; transform: translate3d(0, 20px, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Slide left */
.chat-message.animate-slide_left {
    animation: chatSlideLeft var(--chat-animation-duration, 300ms) cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes chatSlideLeft {
    from { opacity: 0; transform: translate3d(-20px, 0, 0); }
    to   { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* Fade */
.chat-message.animate-fade {
    animation: chatFadeIn var(--chat-animation-duration, 300ms) ease forwards;
}

@keyframes chatFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Pop */
.chat-message.animate-pop {
    animation: chatPop var(--chat-animation-duration, 300ms) cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes chatPop {
    0%   { opacity: 0; transform: scale3d(0.8, 0.8, 1); }
    70%  { transform: scale3d(1.05, 1.05, 1); }
    100% { opacity: 1; transform: scale3d(1, 1, 1); }
}

/* Fade out (exit) */
.chat-message.animate-out {
    animation: chatFadeOut 300ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes chatFadeOut {
    from { opacity: 1; transform: translate3d(0, 0, 0); }
    to   { opacity: 0; transform: translate3d(0, -10px, 0); }
}

/* Legacy fade-out class */
.fade-out {
    animation: chatFadeOut 0.5s forwards;
}

/* =========================================
   MESSAGE DELETED — red flash + shrink out
   ========================================= */
.msg-deleted {
    animation: msgDelete 0.5s ease forwards;
    pointer-events: none;
}

@keyframes msgDelete {
    0%   { opacity: 1; transform: scaleX(1); background: rgba(18, 18, 22, 0.55); }
    20%  { opacity: 1; transform: scaleX(1); background: rgba(220, 38, 38, 0.25); }
    100% { opacity: 0; transform: scaleX(0.8) translateX(-20px); max-height: 0; padding: 0; margin: 0; }
}

/* Also support the .deleted class for backward compatibility */
.chat-message.deleted {
    animation: msgDelete 0.5s ease forwards;
    pointer-events: none;
}

/* =========================================
   AVATAR
   ========================================= */
.chat-avatar {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    object-fit: cover;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-avatar .avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
}

.chat-avatar.hidden {
    display: none;
}

/* USERNAME */
.chat-username {
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
    margin-right: 2px;
}

/* MESSAGE TEXT */
.chat-message-content,
.chat-text {
    color: #ffffff;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-width: 0;
}

/* @Mentions */
.mention-tag {
    font-weight: 600;
}

/* Badges */
.chat-badges {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.chat-badges img,
.chat-badge {
    height: 14px;
    width: auto;
    object-fit: contain;
    opacity: 0.85;
    vertical-align: middle;
    margin-right: 2px;
}

/* Emotes */
.chat-message-content img {
    display: inline-block;
    vertical-align: middle;
    height: 1.5em;
    margin: -0.15em 0.1em 0 0.1em;
}

.chat-emote {
    display: inline-block;
    height: 1.75em;
    width: auto;
    vertical-align: middle;
    margin: -0.15em 0.1em 0 0.1em;
    pointer-events: none;
    user-select: none;
    object-fit: contain;
}

/* Timestamps */
.chat-timestamp {
    font-size: 0.8em;
    opacity: 0.7;
    margin-left: 6px;
}

/* Rant amount */
.chat-rant-amount {
    font-weight: 700;
    margin-left: 8px;
}

/* Rant message highlighting */
.chat-message.rant {
    background: rgba(133, 199, 66, 0.15);
    border-left: 3px solid #85c742;
}

/* Text shadow (optional, toggled by config) */
.chat-message.text-shadow-on .chat-message-content,
.chat-message.text-shadow-on .chat-text,
.chat-message.text-shadow-on .chat-username {
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

/* =========================================
   EVENT MESSAGES — subs, gifts, follows, raids
   Animated entrance, glowing outline, icon bounce.
   ========================================= */
.chat-event {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    color: #ffffff;
    flex-shrink: 0;
    background: rgba(18, 18, 22, 0.65);
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--evt-color, rgba(255,255,255,0.2));
    position: relative;
    overflow: hidden;

    /* Entrance: slide up + slight scale */
    animation: eventSlideIn 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15) forwards;
    opacity: 0;

    /* GPU acceleration */
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* Shimmer sweep across background */
.chat-event::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; right: 0; bottom: 0;
    width: 200%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.06) 40%,
        rgba(255,255,255,0.12) 50%,
        rgba(255,255,255,0.06) 60%,
        transparent 100%
    );
    animation: eventShimmer 1.2s 0.3s ease-out forwards;
    pointer-events: none;
}

/* Glow pulse on the outline — plays 3 times then stops */
.chat-event::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 7px;
    border: 1px solid var(--evt-color, rgba(255,255,255,0.2));
    box-shadow: 0 0 8px var(--evt-color, transparent),
                inset 0 0 8px var(--evt-color-dim, transparent);
    animation: eventGlow 0.8s ease-in-out 3;
    pointer-events: none;
    opacity: 0;
}

@keyframes eventSlideIn {
    0%   { opacity: 0; transform: translateY(12px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes eventShimmer {
    0%   { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

@keyframes eventGlow {
    0%, 100% { opacity: 0; }
    50%      { opacity: 0.6; }
}

/* Icon bounces on entrance */
.chat-event .event-icon {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: iconBounce 0.5s 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes iconBounce {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.chat-event .event-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chat-event .event-username {
    font-weight: 700;
    color: #ffffff;
}

.chat-event .event-text {
    color: rgba(255, 255, 255, 0.9);
}

.chat-event .event-detail {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 400;
}

/* ---- Per-type colors ---- */
.chat-event.event-sub {
    --evt-color: #a78bfa;
    --evt-color-dim: rgba(167, 139, 250, 0.15);
}
.chat-event.event-sub .event-icon { color: #a78bfa; }

.chat-event.event-giftsub {
    --evt-color: #f472b6;
    --evt-color-dim: rgba(244, 114, 182, 0.15);
}
.chat-event.event-giftsub .event-icon { color: #f472b6; }

.chat-event.event-follow {
    --evt-color: #34d399;
    --evt-color-dim: rgba(52, 211, 153, 0.15);
}
.chat-event.event-follow .event-icon { color: #34d399; }

.chat-event.event-raid {
    --evt-color: #fb923c;
    --evt-color-dim: rgba(251, 146, 60, 0.15);
}
.chat-event.event-raid .event-icon { color: #fb923c; }

.chat-event.event-host {
    --evt-color: #60a5fa;
    --evt-color-dim: rgba(96, 165, 250, 0.15);
}
.chat-event.event-host .event-icon { color: #60a5fa; }

/* Rant event */
.chat-event.event-rant {
    --evt-color: #85c742;
    --evt-color-dim: rgba(133, 199, 66, 0.15);
}
.chat-event.event-rant .event-icon { color: #85c742; }



/* _goals.css */
/* =========================================
   GOAL WIDGET — SBCanvas Overlay
   Exact reproduction of the prototype design.
   Class names match prototype: goal-widget, theme-*, huge-icon-circle, etc.
   ========================================= */

/* --- CSS Variables & Layout --- */
#goals-container {
    --widget-max-width: 520px;
    --track-height: 44px;
    --border-radius: 12px;
    --icon-size: 64px;

    /* Fill the parent widget element bounds — position/z-index comes from _core.css
       but gets overridden by inline styles when migrated into a canvas widget. */
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 60px;
    padding: 20px;
    font-family: 'Poppins', sans-serif;
    pointer-events: auto;
}


/* --- WIDGET SHELL --- */
.goal-widget {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: calc(var(--widget-max-width) + 20px);
    transform: translateZ(0);
    will-change: transform, opacity;
    overflow: visible;
    pointer-events: auto;
}

/* --- TITLE --- */
.goal-widget .goal-title {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-left: 24px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transition: all 0.8s ease;
}

/* --- BAR WRAPPER --- */
.goal-bar-wrapper {
    position: relative;
    width: 100%;
    height: var(--icon-size);
}

/* --- TRACK BACKGROUND --- */
.goal-bar-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 20px;
    right: 0;
    height: var(--track-height);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: all 0.8s ease;
}

/* --- TEXT LAYERS (dual-layer knockout) --- */
.goal-widget .text-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: var(--track-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px 0 50px;
    font-size: 15px;
    font-weight: 700;
    pointer-events: none;
    box-sizing: border-box;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    letter-spacing: 0.3px;
    gap: 8px;
}

/* Prevent goal name from overflowing into amounts */
.goal-widget .goal-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 auto;
}

/* Keep amounts from shrinking */
.goal-widget .goal-amounts {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* --- PROGRESS FILL --- */
.goal-bar-progress {
    position: absolute;
    top: 0; left: 0;
    height: 100%;
    width: 100%;
    clip-path: inset(0 100% 0 0);
    overflow: hidden;
    transition: clip-path 0.7s cubic-bezier(0.25, 1.25, 0.4, 1), background 0.7s ease;
    transform: translateZ(0);
}

/*
 * Knockout text fix: By setting goal-bar-progress to width: 100% and
 * clipping it via clip-path, its inner text-layer can effortlessly span
 * 100% of the track avoiding overflow/clipping bugs at full width.
 */
.goal-bar-progress .text-layer {
    width: 100%;
}

/* --- HUGE ICON CIRCLE --- */
.huge-icon-circle {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: var(--icon-size);
    height: var(--icon-size);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    z-index: 10;
    box-shadow: 0 5px 14px rgba(0,0,0,0.3);
    transition: all 0.8s ease;
}

/* Breathing pulse */
@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}
.huge-icon-circle i {
    animation: iconPulse 2.8s ease-in-out infinite;
}

/* =========================================
   THEMES
   ========================================= */

/* --- SUNSET --- */
.theme-sunset .goal-bar-track          { background: #221e2c; }
.theme-sunset .base-text               { color: #1abc9c; }
.theme-sunset .goal-bar-progress       { background: #f3a652; }
.theme-sunset .progress-text           { color: #221e2c; }
.theme-sunset .huge-icon-circle        { background: #221e2c; color: #f3a652; border: 3px solid #f3a652; }

/* --- DONATION --- */
.theme-donation .goal-title            { color: #ff6b9d; }
.theme-donation .goal-bar-track        { background: #1e1a2e; }
.theme-donation .base-text             { color: #ff6b9d; }
.theme-donation .goal-bar-progress     { background: #ff6b9d; }
.theme-donation .progress-text         { color: #ffffff; }
.theme-donation .huge-icon-circle      { background: #1e1a2e; color: #ff6b9d; border: 3px solid #ff6b9d; }

/* --- ENERGY --- */
.theme-energy .goal-title              { color: #a4f836; }
.theme-energy .goal-bar-track          { background: #181c22; }
.theme-energy .base-text               { color: #ffffff; }
.theme-energy .goal-bar-progress       { background: #a4f836; }
.theme-energy .progress-text           { color: #181c22; }
.theme-energy .huge-icon-circle        { background: #181c22; color: #a4f836; border: 3px solid #a4f836; }

/* --- CALM --- */
.theme-calm .goal-title                { color: #ffffff; }
.theme-calm .goal-bar-track            { background: #ffffff; }
.theme-calm .base-text                 { color: #f67470; }
.theme-calm .goal-bar-progress         { background: #76e1e5; }
.theme-calm .progress-text             { color: #ffffff; }
.theme-calm .huge-icon-circle          { background: #1a2228; color: #76e1e5; border: 3px solid #76e1e5; }

/* =========================================
   INLINE ICON VARIATION
   ========================================= */

.goal-widget.layout-inline {
    max-width: var(--widget-max-width);
}

.goal-widget.layout-inline .goal-title {
    margin-left: 24px;
}

.goal-widget.layout-inline .goal-bar-wrapper {
    height: var(--track-height);
}

.goal-widget.layout-inline .goal-bar-track {
    top: 0;
    transform: none;
    left: 0;
    height: 100%;
    border-radius: 999px;
}

.goal-widget.layout-inline .goal-bar-progress {
    border-radius: 999px;
}

.goal-widget.layout-inline .text-layer {
    padding: 0 16px 0 6px;
}

.goal-widget.layout-inline .goal-name {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: visible;
}

.goal-widget.layout-inline .goal-name-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.goal-widget.layout-inline .huge-icon-circle {
    position: relative;
    top: -1px;
    left: auto;
    transform: none;
    width: 32px;
    height: 32px;
    font-size: 18px;
    box-shadow: none;
    border: none !important;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--goal-inline-track-bg, #181c22) !important;
    color: var(--goal-inline-icon-color, currentColor) !important;
}

.goal-widget.layout-inline .huge-icon-circle i {
    animation: none;
}

@keyframes iconBounceInline {
    0%   { transform: scale(1); }
    20%  { transform: scale(1.3); }
    40%  { transform: scale(0.9); }
    60%  { transform: scale(1.12); }
    80%  { transform: scale(0.97); }
    100% { transform: scale(1); }
}

.goal-widget.layout-inline .huge-icon-circle.bounce {
    animation: iconBounceInline 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

.goal-widget.layout-inline .shockwave-ring {
    display: none;
}

/* =========================================
   ICON BOUNCE
   ========================================= */
@keyframes iconBounce {
    0%   { transform: translateY(-50%) scale(1); }
    20%  { transform: translateY(-50%) scale(1.3); }
    40%  { transform: translateY(-50%) scale(0.9); }
    60%  { transform: translateY(-50%) scale(1.12); }
    80%  { transform: translateY(-50%) scale(0.97); }
    100% { transform: translateY(-50%) scale(1); }
}
.huge-icon-circle.bounce {
    animation: iconBounce 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

/* =========================================
   GOAL REACHED CELEBRATION
   ========================================= */

/* Flash overlay */
@keyframes goalFlash {
    0%   { opacity: 0; transform: scaleX(1); }
    15%  { opacity: 1; }
    50%  { opacity: 0.6; }
    100% { opacity: 0; transform: scaleX(1.05); }
}
.goal-bar-track .goal-flash-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--border-radius);
    z-index: 5;
    opacity: 0;
    pointer-events: none;
}
.goal-bar-track .goal-flash-overlay.active {
    animation: goalFlash 0.8s ease-out forwards;
}

/* Icon celebrate glow */
@keyframes celebrateGlow {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9); }
    30%  { box-shadow: 0 0 30px 15px rgba(255, 255, 255, 0.5); }
    60%  { box-shadow: 0 0 45px 20px rgba(255, 255, 255, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
.huge-icon-circle.celebrate {
    animation: celebrateGlow 1.4s ease-out forwards, iconBounce 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

.goal-widget.layout-inline .huge-icon-circle.celebrate {
    animation: celebrateGlow 1.4s ease-out forwards, iconBounceInline 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

/* =========================================
   SHOCKWAVE RIPPLE
   ========================================= */
.shockwave-ring {
    position: absolute;
    left: calc(var(--icon-size) / 2);
    top: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    z-index: 20;
}
@keyframes shockwaveExpand {
    0%   { width: 0; height: 0; opacity: 0.9; border-width: 4px; }
    30%  { opacity: 0.7; border-width: 3px; }
    70%  { opacity: 0.3; border-width: 2px; }
    100% { width: 400px; height: 400px; opacity: 0; border-width: 1px; }
}
.shockwave-ring.active {
    animation: shockwaveExpand 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* Theme-colored shockwave borders */
.theme-sunset .shockwave-ring   { border-color: #f3a652; }
.theme-donation .shockwave-ring { border-color: #ff6b9d; }
.theme-energy .shockwave-ring   { border-color: #a4f836; }
.theme-calm .shockwave-ring     { border-color: #76e1e5; }

/* =========================================
   LATEST CONTRIBUTOR
   ========================================= */
.latest-contributor {
    margin-top: 4px;
    padding-right: 4px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.5px;
    height: 18px;
    overflow: hidden;
    text-align: right;
}
.latest-contributor span {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.latest-contributor span.visible {
    opacity: 1;
    transform: translateY(0);
}
.latest-contributor .contributor-label {
    color: rgba(255, 255, 255, 0.45);
    margin-right: 4px;
}
.latest-contributor .contributor-name {
    color: #ffffff;
}
.latest-contributor .contributor-amount {
    color: #ff6b9d;
    margin-left: 4px;
}

/* =========================================
   OVERDRIVE STATE (post-100%)
   ========================================= */

/* Smooth transition into overdrive */
.goal-widget .goal-bar-track,
.goal-widget .huge-icon-circle,
.goal-widget .goal-title,
.goal-widget .goal-bar-progress {
    transition: all 0.8s ease;
}

/* Shimmer sweep */
@keyframes overdriveShimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* Persistent icon pulse glow */
@keyframes overdriveIconPulse {
    0%, 100% { transform: translateY(-50%) scale(1); filter: brightness(1); }
    50%      { transform: translateY(-50%) scale(1.06); filter: brightness(1.3); }
}

@keyframes overdriveIconPulseInline {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50%      { transform: scale(1.05); filter: brightness(1.2); }
}

/* Base overdrive */
.goal-widget.overdrive .huge-icon-circle {
    animation: overdriveIconPulse 2s ease-in-out infinite;
}
.goal-widget.layout-inline.overdrive .huge-icon-circle {
    animation: overdriveIconPulseInline 2.5s ease-in-out infinite;
}
.goal-widget.overdrive .huge-icon-circle i {
    animation: none;
}
.goal-widget.overdrive .goal-title {
    letter-spacing: 3px;
}
.goal-widget.layout-inline.overdrive .goal-title {
    letter-spacing: 2px;
}
.goal-widget.overdrive .goal-bar-progress {
    background-size: 200% 100%;
    animation: overdriveShimmer 3s linear infinite;
}

/* --- Per-theme overdrive colors --- */

/* SUNSET overdrive — warm gold */
.theme-sunset.overdrive .goal-bar-progress {
    background: linear-gradient(90deg, #f3a652 0%, #ffd700 25%, #fff4b8 50%, #ffd700 75%, #f3a652 100%);
    background-size: 200% 100%;
}
.theme-sunset.overdrive .huge-icon-circle {
    border-color: #ffd700;
    box-shadow: 0 0 20px 6px rgba(255, 215, 0, 0.4);
    color: #ffd700;
}
.theme-sunset.overdrive .goal-title { color: #ffd700; }

/* DONATION overdrive — hot pink */
.theme-donation.overdrive .goal-bar-progress {
    background: linear-gradient(90deg, #ff6b9d 0%, #ff9ec5 25%, #ffd4e8 50%, #ff9ec5 75%, #ff6b9d 100%);
    background-size: 200% 100%;
}
.theme-donation.overdrive .huge-icon-circle {
    border-color: #ff9ec5;
    box-shadow: 0 0 20px 6px rgba(255, 107, 157, 0.4);
    color: #ff9ec5;
}
.theme-donation.overdrive .goal-title { color: #ff9ec5; }

/* ENERGY overdrive — electric lime */
.theme-energy.overdrive .goal-bar-progress {
    background: linear-gradient(90deg, #a4f836 0%, #d4ff70 25%, #f0ffb8 50%, #d4ff70 75%, #a4f836 100%);
    background-size: 200% 100%;
}
.theme-energy.overdrive .huge-icon-circle {
    border-color: #d4ff70;
    box-shadow: 0 0 20px 6px rgba(164, 248, 54, 0.4);
    color: #d4ff70;
}
.theme-energy.overdrive .goal-title { color: #d4ff70; }

/* CALM overdrive — bright cyan */
.theme-calm.overdrive .goal-bar-progress {
    background: linear-gradient(90deg, #76e1e5 0%, #a8f0f4 25%, #d4fcff 50%, #a8f0f4 75%, #76e1e5 100%);
    background-size: 200% 100%;
}
.theme-calm.overdrive .huge-icon-circle {
    border-color: #a8f0f4;
    box-shadow: 0 0 20px 6px rgba(118, 225, 229, 0.4);
    color: #a8f0f4;
}
.theme-calm.overdrive .goal-title { color: #a8f0f4; }


/* _pin_customization.css */
/* Pin & Delete Event Customization Variables */

#pinned-message-container {
    margin-bottom: var(--pin-margin-bottom, 12px);
}

.pinned-message {
    background: var(--pin-bg-color, rgba(0, 0, 0, 0.85));
    border-left: var(--pin-border-width, 4px) solid var(--pin-border-color, #85c742);
    padding: var(--pin-padding, 12px);
    border-radius: var(--pin-border-radius, 8px);
    box-shadow: var(--pin-shadow, 0 4px 15px rgba(0, 0, 0, 0.3));
    backdrop-filter: blur(var(--pin-backdrop-blur, 8px));
    -webkit-backdrop-filter: blur(var(--pin-backdrop-blur, 8px));
}

.pinned-message .pin-icon {
    font-size: var(--pin-icon-size, 1.2em);
}

.pinned-message.animate-slide_down {
    animation-duration: var(--pin-animation-duration, 400ms);
    animation-timing-function: var(--pin-animation-timing, cubic-bezier(0.4, 0, 0.2, 1));
}

.chat-message.deleted {
    opacity: var(--delete-opacity, 0.3);
    filter: var(--delete-filter, grayscale(100%));
    transition: opacity 300ms ease-out, filter 300ms ease-out;
}

/* _pin_v2.css */
/* Updated Pin Message Styles */

#pinned-message-container {
    margin-bottom: var(--pin-margin-bottom, 12px);
    z-index: 100;
}

#pinned-message-container.hidden {
    display: none;
}

.pinned-message-wrapper {
    background: var(--pin-bg-color, rgba(0, 0, 0, 0.9));
    border-left: var(--pin-border-width, 4px) solid var(--pin-border-color, #85c742);
    border-radius: var(--pin-border-radius, 8px);
    box-shadow: var(--pin-shadow, 0 4px 15px rgba(0, 0, 0, 0.4));
    margin-bottom: var(--pin-margin-bottom, 8px);
    overflow: hidden;
    /* GPU acceleration */
    will-change: transform, opacity;
    transform: translateZ(0);
}

.pin-header {
    background: var(--pin-border-color, #85c742);
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #000;
}

.pin-label {
    display: inline-block;
}

.pinned-chat-message {
    padding: var(--pin-padding, 12px);
    margin: 0 !important;
}

@keyframes chatSlideDown {
    from {
        opacity: 0;
        transform: translate3d(0, -20px, 0);
    }

    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.pinned-message-wrapper.animate-slide_down {
    animation: chatSlideDown var(--pin-animation-duration, 400ms) var(--pin-animation-timing, cubic-bezier(0.4, 0, 0.2, 1)) forwards;
}

/* Deleted message styling */
.chat-message.deleted {
    opacity: var(--delete-opacity, 0.3);
    filter: var(--delete-filter, grayscale(100%));
    transition: opacity 300ms ease-out, filter 300ms ease-out;
}

