/* ============================================================
   LuminaForge AI Chat Widget — "Luna"
   Premium dark editorial — dopasowany do języka wizualnego strony
   ============================================================ */

:root {
    --luna-bg:          #0f0f14;   /* main dark — zgodne z tłem strony */
    --luna-surface:     #18181f;   /* karty / header */
    --luna-surface-2:   #1e1e28;   /* nieco jaśniejsze (input row) */
    --luna-surface-3:   #232330;   /* bot bubble + input field */
    --luna-text:        #e4e4ed;
    --luna-text-muted:  #9ca3af;
    --luna-text-faint:  #5a5a6a;
    --luna-purple:      #8B5CF6;
    --luna-purple-deep: #6D28D9;
    --luna-accent-rgb:  139, 92, 246;
    --luna-accent-soft: #bdb0db;
    --luna-soft-rgb:    216, 180, 254;
    --luna-glow-bg:     #281d52;   /* tło gradientu glow kuleczki */
    --luna-on-accent:   #fff;      /* tekst na akcentowym tle */
    --luna-purple-tint: rgba(var(--luna-accent-rgb), 0.06);
    --luna-purple-glow: rgba(var(--luna-accent-rgb), 0.35);
    --luna-border:      rgba(255, 255, 255, 0.08);
    --luna-border-soft: rgba(255, 255, 255, 0.04);
    --luna-shadow:      0 24px 60px rgba(0, 0, 0, 0.5), 0 8px 24px rgba(0,0,0,0.3);
    --luna-shadow-card: 0 20px 50px rgba(0, 0, 0, 0.3);
    --luna-radius:      12px;
    --luna-radius-sm:   8px;
    --luna-ease:        cubic-bezier(0.22, 1, 0.36, 1);
    --luna-font:        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --luna-font-serif:  "Playfair Display", Georgia, serif;
}

/* ===== Motyw: Las — Luna w ciemnej zieleni i złocie ===== */
:root[data-theme="forest"] {
    --luna-bg:          #132B23;
    --luna-surface:     #18342A;
    --luna-surface-2:   #1D3E32;
    --luna-surface-3:   #23493B;
    --luna-text:        #E7DFCF;
    --luna-text-muted:  #B1B7AB;
    --luna-text-faint:  #5E775E;
    --luna-purple:      #BA9B5F;   /* złoto (nazwa historyczna) */
    --luna-purple-deep: #9A7C45;
    --luna-accent-rgb:  186, 155, 95;
    --luna-accent-soft: #D9C69C;
    --luna-soft-rgb:    217, 198, 156;
    --luna-glow-bg:     #0D3A35;   /* deep bluish */
    --luna-on-accent:   #132B23;
    --luna-border:      rgba(233, 224, 207, 0.08);
    --luna-border-soft: rgba(233, 224, 207, 0.04);
}

/* ============================================================
   FLOATING BUBBLE
   ============================================================ */
.luna-bubble {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--luna-surface);
    border: 1px solid var(--luna-border);
    cursor: pointer;
    z-index: 99998;
    color: var(--luna-text);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        var(--luna-shadow-card),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition:
        transform 0.5s var(--luna-ease),
        border-color 0.4s var(--luna-ease),
        box-shadow 0.4s var(--luna-ease),
        color 0.3s var(--luna-ease);
}
.luna-bubble::before {
    /* delikatny glow pod kuleczką */
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--luna-purple-glow) 0%, transparent 70%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.5s var(--luna-ease);
    filter: blur(12px);
}
.luna-bubble:hover {
    border-color: var(--luna-purple);
    color: var(--luna-purple);
    transform: translateY(-3px);
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.4),
        0 8px 30px var(--luna-purple-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.luna-bubble:hover::before { opacity: 1; }
.luna-bubble:active { transform: translateY(-1px) scale(0.97); }
.luna-bubble svg { width: 24px; height: 24px; stroke-width: 1.6; }

/* status dot — sygnalizuje "online" */
.luna-bubble-status {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--luna-purple);
    border: 2px solid var(--luna-bg);
    box-shadow: 0 0 8px var(--luna-purple-glow);
}

.luna-bubble.is-open {
    transform: scale(0) rotate(-30deg);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s var(--luna-ease), opacity 0.3s ease;
}

/* ============================================================
   CHAT PANEL
   ============================================================ */
.luna-panel {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 56px);
    background: var(--luna-bg);
    border: 1px solid var(--luna-border);
    border-radius: var(--luna-radius);
    box-shadow:
        var(--luna-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    opacity: 0;
    transform: translateY(24px) scale(0.97);
    transform-origin: bottom right;
    pointer-events: none;
    transition:
        opacity 0.3s var(--luna-ease),
        transform 0.45s var(--luna-ease);
    font-family: var(--luna-font);
    color: var(--luna-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.luna-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ============================================================
   HEADER
   ============================================================ */
.luna-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--luna-surface);
    border-bottom: 1px solid var(--luna-border);
    flex-shrink: 0;
    position: relative;
}
.luna-header::after {
    /* subtelny purple highlight pod headerem */
    content: "";
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--luna-purple) 50%, transparent);
    opacity: 0.4;
}

.luna-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--luna-glow-bg) 0%, var(--luna-bg) 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
    isolation: isolate;
    box-shadow:
        0 0 24px rgba(var(--luna-accent-rgb), 0.55),
        0 0 50px rgba(var(--luna-accent-rgb), 0.18),
        inset 0 -4px 8px rgba(109, 40, 217, 0.55),
        inset 0 4px 7px rgba(255, 255, 255, 0.2);
    animation: luna-avatar-breathe 3.8s var(--luna-ease) infinite;
}
/* Usunięto skomplikowane animacje (aura, orbity, iskry) na rzecz czystszego wyglądu */

.luna-header-info { flex: 1; min-width: 0; }
.luna-header-name {
    font-family: var(--luna-font-serif);
    font-weight: 600;
    font-size: 18px;
    line-height: 1.1;
    color: var(--luna-text);
    letter-spacing: 0.01em;
}
.luna-header-status {
    font-size: 10px;
    color: var(--luna-text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
}

.luna-close {
    background: transparent;
    border: 1px solid var(--luna-border);
    color: var(--luna-text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        color 0.3s var(--luna-ease),
        border-color 0.3s var(--luna-ease),
        transform 0.4s var(--luna-ease);
}
.luna-close:hover {
    color: var(--luna-text);
    border-color: var(--luna-purple);
    transform: rotate(90deg);
}
.luna-close svg { width: 14px; height: 14px; stroke-width: 2; }

/* ============================================================
   WELCOME SCREEN — pierwszy ekran zanim user coś napisze
   ============================================================ */
.luna-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 28px 24px; /* Zmniejszono górny padding z 32px na 8px */
    background: var(--luna-bg);
    overflow: hidden;
    animation: luna-welcome-in 0.6s var(--luna-ease) both;
    transition: opacity 0.4s var(--luna-ease), transform 0.4s var(--luna-ease);
}
.luna-panel.luna-started .luna-welcome {
    display: none;
}
.luna-panel:not(.luna-started) .luna-messages {
    display: none;
}
@keyframes luna-welcome-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   ORB — liquid SVG blob (gooey filter) + magic particles
   ============================================================ */
.luna-orb-wrap {
    position: relative;
    width: 168px;
    height: 168px;
    margin: 4px auto 26px;
    display: block;
    isolation: isolate;
}
.luna-lottie {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.luna-orb-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    transform-origin: center;
    opacity: 0;
    transform: scale(0.35) rotate(-8deg);
    filter: drop-shadow(0 14px 38px rgba(var(--luna-accent-rgb), 0.42));
    transition:
        opacity 0.7s var(--luna-ease),
        transform 1.05s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.luna-panel.is-open .luna-orb-svg {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

/* HALO — radial glow w tle, łagodny puls */
.luna-orb-halo {
    transform-box: fill-box;
    transform-origin: center;
    animation: luna-halo-pulse 5.2s ease-in-out infinite;
}

/* GROUP - całość blobów lekko oddycha (skala) */
.luna-orb-blobs {
    transform-box: fill-box;
    transform-origin: center;
    animation: luna-blobs-breathe 6.5s ease-in-out infinite;
}

/* CORE blob — duża centralna kropla, delikatny puls */
.luna-blob {
    transform-box: fill-box;
    transform-origin: center;
    will-change: transform;
}
.luna-blob-core {
    animation: luna-core-pulse 4.4s ease-in-out infinite;
}

/* Małe orbitujące blobki — gooey filter łączy je w płynną materię */
.luna-blob-1 { animation: luna-blob-orbit-1 7s ease-in-out infinite; }
.luna-blob-2 { animation: luna-blob-orbit-2 8.5s ease-in-out infinite; }
.luna-blob-3 { animation: luna-blob-orbit-3 6s   ease-in-out infinite; }
.luna-blob-4 { animation: luna-blob-orbit-4 9.5s ease-in-out infinite; }

/* SPECULAR highlight — refleks światła, łagodny dryf */
.luna-orb-shine {
    transform-box: fill-box;
    transform-origin: center;
    mix-blend-mode: screen;
    animation: luna-shine-drift 5.5s ease-in-out infinite;
}

/* PARTICLES — magiczny pył wokół orbu, twinkle */
.luna-particle {
    transform-box: fill-box;
    transform-origin: center;
    opacity: 0;
    animation: luna-particle-twinkle 3.6s ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(var(--luna-soft-rgb), 0.9));
}
.luna-p1 { animation-delay: 0.30s; }
.luna-p2 { animation-delay: 0.85s; animation-duration: 4.1s; }
.luna-p3 { animation-delay: 1.45s; animation-duration: 3.2s; }
.luna-p4 { animation-delay: 0.55s; animation-duration: 4.4s; }
.luna-p5 { animation-delay: 1.95s; animation-duration: 3.5s; }
.luna-p6 { animation-delay: 1.10s; animation-duration: 3.9s; }
.luna-p7 { animation-delay: 1.70s; animation-duration: 4.2s; }
.luna-p8 { animation-delay: 0.40s; animation-duration: 3.4s; }

@keyframes luna-halo-pulse {
    0%, 100% { opacity: 0.95; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.08); }
}
@keyframes luna-blobs-breathe {
    0%, 100% { transform: scale(1)    rotate(0deg); }
    50%      { transform: scale(1.04) rotate(6deg); }
}
@keyframes luna-core-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}
/* każda orbita inny tor, inna prędkość — gooey filter rozmywa różnice w jedną materię */
@keyframes luna-blob-orbit-1 {
    0%   { transform: translate(0, -32px)   scale(1); }
    25%  { transform: translate(30px, -8px) scale(0.85); }
    50%  { transform: translate(18px, 26px) scale(1.15); }
    75%  { transform: translate(-24px, 14px) scale(0.95); }
    100% { transform: translate(0, -32px)   scale(1); }
}
@keyframes luna-blob-orbit-2 {
    0%   { transform: translate(28px, 18px)   scale(1); }
    33%  { transform: translate(-12px, 32px)  scale(1.18); }
    66%  { transform: translate(-30px, -16px) scale(0.82); }
    100% { transform: translate(28px, 18px)   scale(1); }
}
@keyframes luna-blob-orbit-3 {
    0%   { transform: translate(-26px, -20px) scale(1); }
    50%  { transform: translate(24px, 22px)   scale(1.12); }
    100% { transform: translate(-26px, -20px) scale(1); }
}
@keyframes luna-blob-orbit-4 {
    0%   { transform: translate(22px, -24px)  scale(0.9); }
    25%  { transform: translate(-28px, -10px) scale(1.05); }
    50%  { transform: translate(-20px, 26px)  scale(1); }
    75%  { transform: translate(28px, 14px)   scale(1.12); }
    100% { transform: translate(22px, -24px)  scale(0.9); }
}
@keyframes luna-shine-drift {
    0%, 100% { transform: translate(0, 0)    scale(1);    opacity: 0.55; }
    50%      { transform: translate(7px, 5px) scale(1.15); opacity: 0.85; }
}
@keyframes luna-particle-twinkle {
    0%, 100% { opacity: 0;    transform: scale(0.5); }
    40%      { opacity: 0.95; transform: scale(1.3); }
    60%      { opacity: 0.7;  transform: scale(1.1); }
}

/* ----- TEKSTY ----- */
.luna-welcome-greeting {
    margin: 0 0 12px;
    min-height: 50px;
    position: relative;
    display: block;
    /* Defensywnie: nawet jak coś dziwnego trafi do imienia, mieści się w panelu */
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* "Witaj" / "Witaj," — editorial per-letter mask reveal, każda litera wjeżdża z dołu */
.luna-greeting-static {
    font-family: var(--luna-font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 40px;
    line-height: 1.15;
    color: var(--luna-text);
    letter-spacing: 0.005em;
    display: inline-flex;
    vertical-align: baseline;
}

/* Maska — overflow:hidden, z buforem na descendery (j, y) i ascendery */
.luna-letter-mask {
    display: inline-block;
    overflow: hidden;
    line-height: 1.15;
    padding: 0.18em 0.01em 0.22em;
    margin: -0.18em -0.01em -0.22em;
    vertical-align: baseline;
}

/* Litera — startuje pod maską, wyjeżdża do góry z lekkim wzrostem skali (organic feel).
   Snappier easing — krótki dystans, szybka deceleracja, energiczny wjazd. */
.luna-letter-rise {
    display: inline-block;
    transform: translateY(95%) scale(0.96);
    filter: blur(3px);
    opacity: 0;
    transition:
        transform 560ms cubic-bezier(0.22, 1, 0.36, 1),
        filter 440ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 440ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform, filter, opacity;
}

.luna-greeting-static.show .luna-letter-rise {
    transform: translateY(0) scale(1);
    filter: blur(0);
    opacity: 1;
}

/* Imię — Satisfy, muted lavender (krewniak --luna-purple, mieści się w palecie strony).
   Inna animacja niż Witaj: per-letter sequential reveal — litera po literze jak pisanie piórem,
   nie unified-block wipe. Stagger > duration: poprzednia litera już stoi gdy startuje następna. */
.luna-greeting-handwrite {
    font-family: 'Satisfy', cursive;
    font-size: 44px;
    line-height: 1.15;
    color: var(--luna-accent-soft);
    display: inline-block;
    margin-left: 12px;
    vertical-align: baseline;
}

.luna-name-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(6px) scale(0.86);
    filter: blur(2px);
    transition:
        opacity 320ms cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 360ms cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 260ms cubic-bezier(0.25, 1, 0.5, 1);
    will-change: opacity, transform, filter;
}

.luna-greeting-handwrite.show .luna-name-letter {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

.luna-welcome-name {
    font-family: var(--luna-font);
    font-size: 13px;
    font-weight: 500;
    color: var(--luna-text-muted);
    margin: 0 0 22px;
    text-transform: uppercase;
    letter-spacing: 3px;
}
.luna-welcome-name em {
    font-style: normal;
    color: var(--luna-purple);
    font-weight: 600;
    display: inline-block;
}
.luna-flash {
    animation: luna-text-flash 0.8s ease-out forwards;
}
@keyframes luna-text-flash {
    0% {
        opacity: 0;
        transform: scale(0.8);
        text-shadow: 0 0 0 transparent;
    }
    40% {
        opacity: 1;
        transform: scale(1.15);
        text-shadow: 0 0 25px #fff, 0 0 40px var(--luna-purple);
        color: #fff;
    }
    100% {
        opacity: 1;
        transform: scale(1);
        text-shadow: 0 0 10px var(--luna-purple-glow);
        color: var(--luna-purple);
    }
}
.luna-welcome-desc {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--luna-text-muted);
    max-width: 280px;
    margin: 0 0 24px;
}
/* ============================================================
   LIGHTBOX (podgląd zdjęć w pełnoekranowym overlayu)
   ============================================================ */
.luna-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: lunaLightboxFade 0.22s var(--luna-ease);
    padding: 24px;
}
.luna-lightbox-overlay img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: var(--luna-radius);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
    cursor: default;
    animation: lunaLightboxZoom 0.28s var(--luna-ease);
}
.luna-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s var(--luna-ease), transform 0.15s var(--luna-ease);
    backdrop-filter: blur(8px);
}
.luna-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
}
.luna-lightbox-close svg {
    width: 22px;
    height: 22px;
}
@keyframes lunaLightboxFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes lunaLightboxZoom {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

.luna-directions-link {
    margin: 6px 0 4px;
    padding: 10px 12px;
    background: var(--luna-purple-tint);
    border: 1px solid var(--luna-purple-glow);
    border-radius: var(--luna-radius-sm);
}
.luna-directions-link a {
    color: var(--luna-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}
.luna-directions-link a:hover { text-decoration: underline; }

.luna-welcome-hint {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--luna-text-faint);
    margin: 0;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.luna-hint-arrow {
    display: inline-block;
    font-size: 13px;
    line-height: 1;
    color: var(--luna-purple);
    opacity: 0.7;
    animation: luna-hint-bob 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    will-change: transform, opacity;
}
@keyframes luna-hint-bob {
    0%, 100% { transform: translateY(0); opacity: 0.45; }
    50%      { transform: translateY(3px); opacity: 0.85; }
}

/* ============================================================
   MESSAGES
   ============================================================ */
.luna-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--luna-bg);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}
.luna-messages::-webkit-scrollbar { width: 4px; }
.luna-messages::-webkit-scrollbar-track { background: transparent; }
.luna-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}
.luna-messages::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

.luna-msg {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    white-space: pre-wrap;
    letter-spacing: 0.005em;
    animation: luna-msg-in 0.4s var(--luna-ease) both;
}
@keyframes luna-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.luna-msg.bot {
    background: var(--luna-surface-3);
    color: var(--luna-text);
    align-self: flex-start;
    border: 1px solid var(--luna-border-soft);
    border-radius: var(--luna-radius);
    border-top-left-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    position: relative; /* dla TTS btn */
}
.luna-msg.user {
    background: var(--luna-purple);
    color: var(--luna-on-accent);
    align-self: flex-end;
    border-radius: var(--luna-radius);
    border-top-right-radius: 4px;
    box-shadow: 0 8px 20px rgba(var(--luna-accent-rgb), 0.25);
    font-weight: 500;
}
.luna-msg a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: rgba(255, 255, 255, 0.4);
    transition: text-decoration-color 0.2s ease;
}
.luna-msg a:hover { text-decoration-color: currentColor; }

/* ============================================================
   TYPING INDICATOR
   ============================================================ */
.luna-typing-wrap {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 8px;
    animation: luna-msg-in 0.3s var(--luna-ease) both;
}
.luna-typing-anim {
    background: var(--luna-surface-3);
    border: 1px solid var(--luna-border-soft);
    border-radius: var(--luna-radius);
    border-top-left-radius: 4px;
    padding: 4px 12px;
    width: 54px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.luna-typing-status {
    font-size: 11px;
    color: var(--luna-text-muted);
    padding-left: 4px;
    font-style: italic;
    animation: luna-status-pulse 1.5s ease-in-out infinite;
}
@keyframes luna-status-pulse {
    0%, 100% { opacity: 0.5; }
    50%      { opacity: 1; }
}

/* ============================================================
   STREAMING — mrugający kursor + delikatny fade-in nowych słów
   ============================================================ */
.luna-msg.bot.streaming {
    /* żywy bąbelek — subtelne podświetlenie krawędzi pod kursorem */
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 0 0 1px rgba(var(--luna-accent-rgb), 0.10);
    transition: box-shadow 0.3s var(--luna-ease);
}
.luna-msg .luna-msg-html-slot:empty { display: none; }
.luna-msg .luna-msg-html-slot:not(:empty) { margin-bottom: 8px; }
.luna-cursor {
    display: inline-block;
    margin-left: 2px;
    color: var(--luna-purple);
    font-weight: 400;
    font-size: 0.95em;
    line-height: 1;
    transform: translateY(-1px);
    animation: luna-cursor-blink 0.9s steps(2, jump-none) infinite;
    will-change: opacity;
}
@keyframes luna-cursor-blink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* ============================================================
   NARRATION LOG — Luna mówi co robi gdy używa narzędzi
   ============================================================ */
.luna-narration-log {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 2px 0 6px 6px;
    max-width: 85%;
    animation: luna-msg-in 0.3s var(--luna-ease) both;
}
.luna-narration-line {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--luna-text-muted);
    padding: 2px 0;
    animation: luna-narr-in 0.35s var(--luna-ease) both;
}
@keyframes luna-narr-in {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}
.luna-narration-icon {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--luna-text-faint);
    position: relative;
    transition: all 0.3s var(--luna-ease);
}
.luna-narration-line.working .luna-narration-icon {
    border-color: var(--luna-purple);
    border-top-color: transparent;
    box-shadow: 0 0 10px rgba(var(--luna-accent-rgb), 0.28);
    animation: luna-narr-spin 0.75s linear infinite;
}
.luna-narration-line.working .luna-narration-txt {
    color: var(--luna-text);
    animation: luna-status-pulse 1.5s ease-in-out infinite;
}
.luna-narration-line.done .luna-narration-icon {
    border-color: var(--luna-purple);
    background: var(--luna-purple);
}
.luna-narration-line.done .luna-narration-icon::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid var(--luna-on-accent);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.luna-narration-line.done .luna-narration-txt {
    color: var(--luna-text-muted);
}
.luna-narration-line.failed .luna-narration-icon {
    border-color: #e0667a;
    background: #e0667a;
}
.luna-narration-line.failed .luna-narration-icon::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 2px;
    width: 2px;
    height: 6px;
    background: #fff;
    border-radius: 1px;
}
.luna-narration-line.failed .luna-narration-txt {
    color: #c97c8a;
}
@keyframes luna-narr-spin {
    to { transform: rotate(360deg); }
}

/* TTS Button */
.luna-tts-btn {
    position: absolute;
    right: -32px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--luna-text-faint);
    cursor: pointer;
    padding: 4px;
    opacity: 0;
    transition: all 0.3s var(--luna-ease);
}
.luna-msg.bot:hover .luna-tts-btn {
    opacity: 1;
    color: var(--luna-purple);
}
.luna-tts-btn svg {
    width: 16px;
    height: 16px;
}

/* Gallery Previews */
.luna-gallery-preview-label {
    font-size: 13px;
    margin-bottom: 10px;
    color: var(--luna-text-muted);
}
.luna-gallery-preview {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.luna-gallery-preview img {
    width: 90px;
    height: 65px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid var(--luna-border);
    transition: transform 0.3s var(--luna-ease);
}
.luna-gallery-preview img:hover {
    transform: scale(1.05);
    border-color: var(--luna-purple);
}


/* ============================================================
   INPUT
   ============================================================ */
.luna-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 14px 16px 6px;
    background: var(--luna-surface);
    border-top: 1px solid var(--luna-border);
    flex-shrink: 0;
}
.luna-input {
    flex: 1;
    background: var(--luna-surface-3);
    border: 1px solid var(--luna-border);
    color: var(--luna-text);
    padding: 12px 16px;
    border-radius: var(--luna-radius);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.45;
    outline: none;
    resize: none;
    max-height: 110px;
    min-height: 44px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
    transition:
        border-color 0.3s var(--luna-ease),
        background 0.3s var(--luna-ease),
        box-shadow 0.3s var(--luna-ease);
}
.luna-input::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}
.luna-input::placeholder {
    color: var(--luna-text-faint);
    font-weight: 400;
}
.luna-input:focus {
    border-color: var(--luna-purple);
    background: var(--luna-surface-2);
    box-shadow: 0 0 0 3px rgba(var(--luna-accent-rgb), 0.12);
}

.luna-send {
    background: transparent;
    color: var(--luna-purple);
    border: 1px solid var(--luna-purple);
    width: 44px;
    height: 44px;
    border-radius: var(--luna-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition:
        background 0.4s var(--luna-ease),
        color 0.3s var(--luna-ease),
        transform 0.3s var(--luna-ease),
        box-shadow 0.4s var(--luna-ease);
}
.luna-send:hover:not(:disabled) {
    background: var(--luna-purple);
    color: var(--luna-on-accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--luna-purple-glow);
}
.luna-send:active:not(:disabled) { transform: translateY(0) scale(0.96); }
.luna-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: var(--luna-border);
    color: var(--luna-text-faint);
}
.luna-send svg { width: 16px; height: 16px; stroke-width: 2; }

/* ============================================================
   FOOTER
   ============================================================ */
.luna-footer {
    text-align: center;
    font-size: 9px;
    color: var(--luna-text-faint);
    padding: 6px 12px 10px;
    background: var(--luna-surface);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    font-weight: 500;
}
.luna-footer span {
    color: var(--luna-text-muted);
}

/* ============================================================
   MOBILE — full screen
   ============================================================ */
@media (max-width: 600px) {
    .luna-panel {
        right: 0;
        bottom: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        height: var(--luna-vh, 100dvh);
        max-height: var(--luna-vh, 100dvh);
        border-radius: 0;
        border: none;
        transform-origin: bottom right;
    }
    .luna-bubble {
        right: 18px;
        bottom: 18px;
        width: 54px;
        height: 54px;
    }
    .luna-header { padding: 16px 18px; }
    .luna-messages { padding: 20px 16px; }
    .luna-input-row { padding: 12px 14px 6px; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .luna-bubble,
    .luna-panel,
    .luna-msg,
    .luna-typing,
    .luna-typing span,
    .luna-close,
    .luna-send,
    .luna-input,
    .luna-orb-svg,
    .luna-orb-halo,
    .luna-orb-blobs,
    .luna-blob,
    .luna-blob-core,
    .luna-blob-1,
    .luna-blob-2,
    .luna-blob-3,
    .luna-blob-4,
    .luna-orb-shine,
    .luna-particle,
    .luna-avatar,
    .luna-avatar-aura,
    .luna-avatar-aura-2,
    .luna-avatar-core,
    .luna-avatar-shimmer,
    .luna-avatar-orbit,
    .luna-avatar-orbit-2,
    .luna-avatar-spark,
    .luna-avatar-spark-2,
    .luna-welcome,
    .luna-welcome-greeting,
    .luna-welcome-name,
    .luna-welcome-desc,
    .luna-welcome-hint {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
    /* Reduced motion — orb musi pozostać widoczny (bez intro animacji) */
    .luna-orb-svg {
        opacity: 1 !important;
        transform: none !important;
    }
    .luna-particle {
        opacity: 0.8 !important;
    }
}

/* ---- PRZERWA TECHNICZNA ----------------------------------------------
   Tabliczka wstawiana zamiast pola tekstowego, gdy LUNA_PRZERWA = true
   (chatbot.js). Trzyma się tych samych zmiennych co reszta widżetu, więc
   nie rozjedzie się przy zmianie motywu. */
.luna-przerwa {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 16px 12px;
    background: var(--luna-surface);
    border-top: 1px solid var(--luna-border);
    flex-shrink: 0;
}
.luna-przerwa-ikona {
    font-size: 20px;
    line-height: 1.3;
    flex-shrink: 0;
}
.luna-przerwa-tresc {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.luna-przerwa-tresc strong {
    color: var(--luna-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}
.luna-przerwa-tresc span {
    color: var(--luna-text-muted);
    font-size: 11.5px;
    line-height: 1.5;
}
@media (max-width: 480px) {
    .luna-przerwa { padding: 12px 14px 10px; }
}
