.lucy-wrap {
    max-width: 520px;
    margin: 0 auto;
    text-align: center;
    font-family: inherit;
}
.lucy-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
}
.lucy-name {
    font-size: 32px;
    font-weight: 600;
    color: #96ac3b;
    margin-top: 6px;
    line-height: 1.3;
}
.lucy-sub {
    font-size: 18px;
    color: #666;
    margin-top: 5px;
    margin-bottom: 14px;
    line-height: 1.35;
}
#lucy-messages {
    text-align: left;
}
.lucy-bubble {
    display: inline-block;
    clear: both;
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 16px;
    margin: 5px 0;
    font-size: 19px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.lucy-her {
    background: #e9e9eb;
    color: #222;
    float: left;
    border-bottom-left-radius: 4px;
}
.lucy-me {
    background: #96ac3b;
    color: #fff;
    float: right;
    border-bottom-right-radius: 4px;
}
.lucy-proofbubble {
    padding: 6px;
}
.lucy-proof {
    max-width: 100%;
    border-radius: 10px;
    display: block;
}
#lucy-thinking {
    /* v0.5.29: tight little pill — the bubble class's pre-wrap
       rendered the blank lines around the dots, blowing the box
       up into a big empty square (Michal, 2026-11-10). */
    padding: 10px 14px;
    line-height: 1;
    font-size: 0;
    white-space: normal;
}
.lucy-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin: 0 2px;
    border-radius: 50%;
    background: #555;
    animation: lucy-dot-bounce 1.2s infinite;
}
.lucy-dot:nth-child(2) { animation-delay: 0.15s; }
.lucy-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes lucy-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}
.lucy-inputrow {
    clear: both;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding-top: 12px;
}
#lucy-input {
    flex: 1;
    font-size: 19px;
    font-family: inherit;
    line-height: 1.35;
    padding: 12px 14px;
    border: 1px solid #ccc;
    border-radius: 24px;
    resize: none;
    /* The theme gives every textarea a tall default height; the
       chat box starts at exactly one line and the script grows it
       (with !important inline height) only as the text wraps. */
    box-sizing: border-box;
    /* The theme's form styling gives textareas a bottom margin;
       inside the flex row that margin stretched the row and pushed
       the send button ~20px below the box. */
    margin: 0;
    height: 52px;
    min-height: 52px;
    max-height: 132px;
    overflow-y: auto;
}
/* The attach and mic buttons live INSIDE the message box (bottom
   corners) so the box gets the row's full width — the three loose
   buttons beside it ate a third of the row (Michal, 2026-11-10). */
.lucy-inputwrap {
    position: relative;
    flex: 1;
    display: flex;
    min-width: 0;
}
.lucy-inputwrap #lucy-input {
    width: 100%;
    padding-left: 46px;
    padding-right: 46px;
}
#lucy-mic, #lucy-attach {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    position: absolute;
    /* Centred on the text line (the one-line box is 52px tall),
       not hugging the bottom edge. When the box grows, the script
       adds .lucy-grown and they drop to the bottom line instead. */
    top: 26px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
#lucy-mic svg, #lucy-attach svg {
    display: block;
}
.lucy-inputwrap.lucy-grown #lucy-mic,
.lucy-inputwrap.lucy-grown #lucy-attach {
    top: auto;
    transform: none;
    bottom: 8px;
}
#lucy-attach {
    left: 8px;
}
#lucy-mic {
    right: 8px;
}
#lucy-attach.lucy-uploading {
    opacity: 0.45;
}
#lucy-mic.lucy-recording {
    background: #f8d7d7;
}
#lucy-send {
    flex: none;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #96ac3b;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#lucy-send:disabled {
    opacity: 0.5;
}

.lucy-options {
    clear: both;
    text-align: left;
    margin: 0 0 10px;
}
.lucy-payrow {
    clear: both;
    text-align: left;
    margin: 0 0 10px;
}
.lucy-chip {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 9px 16px;
    border-radius: 999px;
    border: 2px solid #96ac3b;
    background: #ffffff;
    color: #5c7023;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
}
.lucy-chip:active {
    background: #96ac3b;
    color: #ffffff;
}

/* Phones: use the full width — the conversation should not sit in a
   narrow inset column (Michal, 2026-11-10). The panel breakout lives
   in the page's own style block (.lucy-panel); here the bubbles
   themselves get wider. */
@media (max-width: 640px) {
    .lucy-bubble {
        max-width: 97%;
    }
    .lucy-options {
        margin-bottom: 6px;
    }
    /* Keep the input row inside the panel: the field must be free
       to shrink (flex items are not, by default), the buttons sit
       tighter, and nothing clips at the right edge. */
    .lucy-inputrow {
        gap: 6px;
    }
    #lucy-input {
        min-width: 0;
        padding: 12px 12px;
    }
    .lucy-inputwrap #lucy-input {
        padding-left: 42px;
        padding-right: 42px;
    }
    #lucy-mic, #lucy-attach {
        padding: 0;
        width: 34px;
        height: 34px;
    }
    #lucy-send {
        width: 46px;
        height: 46px;
    }
    /* Pin the input row to the bottom of the screen: in the page
       flow it ended up below the fold (and under Safari's bottom
       toolbar) as the conversation grew — "text window keeps at
       the bottom hidden" (Michal, 2026-11-10). The messages get
       bottom padding and scroll margin so the latest bubble can
       always scroll clear of the pinned bar. v0.5.28: 88/96px
       still left the newest bubble tucked under the bar on
       Michal's iPhone (confirmed by him 2026-11-10) — clearance
       raised to 140px. */
    .lucy-inputrow {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        background: #f8f8f8;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.10);
    }
    #lucy-messages {
        padding-bottom: 140px;
    }
    .lucy-bubble, #lucy-thinking, .lucy-options, .lucy-payrow {
        scroll-margin-bottom: 140px;
    }
    #lucy-thinking {
        /* The thinking dots sit OUTSIDE #lucy-messages, so the
           container's bottom padding never gave them scroll room —
           the bubbles cleared the bar and the dots stayed behind
           it (Michal, 2026-11-10). Their own bottom margin makes
           the room, and only while shown (display:none has none). */
        margin-bottom: 150px;
    }
}

.lucy-paybtn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 999px;
    background: #96ac3b;
    color: #ffffff !important;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none !important;
}

/* Styles picker overlay */
#lucy-styles {
    position: fixed;
    inset: 0;
    background: #ffffff;
    z-index: 99998;
    flex-direction: column;
    text-align: left;
}
.lucy-styles-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 18px;
    font-size: 22px;
    font-weight: 700;
    color: #222222;
    border-bottom: 1px solid #e3e3e3;
}
#lucy-styles-close {
    background: none;
    border: none;
    font-size: 36px;
    line-height: 1;
    padding: 2px 8px;
    cursor: pointer;
    color: #555555;
}
.lucy-styles-grid {
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 24px 12px;
    padding: 16px;
    align-content: flex-start;
}
.lucy-style-cell {
    flex: 0 0 calc(50% - 6px);
    max-width: calc(50% - 6px);
    text-align: center;
    cursor: pointer;
}
.lucy-style-cell img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
}
.lucy-style-cell p {
    font-size: 17px;
    font-weight: 700;
    margin: 4px 0 0;
    line-height: 1.2;
    color: #222222;
}

/* Styles picker: centred half-size panel on desktop (v0.5.39) */
@media (min-width: 641px) {
    #lucy-styles {
        background: rgba(0, 0, 0, 0.55);
        align-items: center;
        justify-content: center;
        padding: 24px 16px;
    }
    .lucy-styles-head {
        width: min(620px, 92vw);
        background: #ffffff;
        border-radius: 14px 14px 0 0;
        border-bottom: 1px solid #e3e3e3;
    }
    .lucy-styles-grid {
        width: min(620px, 92vw);
        background: #ffffff;
        border-radius: 0 0 14px 14px;
        max-height: 76vh;
        box-sizing: border-box;
    }
}

/* Reorder picker: a small tappable grid of the customer's own
   previous designs (v0.9.2) */
.lucy-pastgrid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 6px 0 10px;
}
.lucy-pastcell {
    position: relative;
    flex: 1 1 calc(50% - 10px);
    max-width: calc(50% - 5px);
    text-align: center;
    cursor: pointer;
}
.lucy-pastcell img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    border: 2px solid #e3e3e3;
}
.lucy-pastcell p {
    font-size: 14px;
    margin: 3px 0 0;
    line-height: 1.2;
    color: #555555;
}
.lucy-pastbadge {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #96ac3b;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    line-height: 24px;
    text-align: center;
}
.lucy-pastgrid.picked {
    opacity: 0.55;
    pointer-events: none;
}
