:root {
    --primary: #934939;
    --primary-dark: #7f3d30;
    --primary-light: #b46a59;

    --background: #faf8f6;
    --surface: #ffffff;
    --surface-soft: #f3ece8;

    --text: #2f2926;
    --text-light: #6f625d;

    --border: #e5d7d1;
    --shadow: rgba(147, 73, 57, 0.18);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

button {
    font: inherit;
    color: inherit;
}

/* Chat Launcher */

#chat-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
}

.launcher-card {
    min-width: 230px;
    padding: 14px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 30px var(--shadow);
    cursor: pointer;
    transition: .2s ease;
}

.launcher-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(147, 73, 57, .24);
}

.launcher-title {
    margin-bottom: 4px;
    color: var(--primary);
    font-size: 15px;
    font-weight: 700;
}

.launcher-subtitle {
    color: var(--text-light);
    font-size: 13px;
}

#chat-button {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(147, 73, 57, .35);
    transition: .2s ease;
}

#chat-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(147, 73, 57, .42);
}

#chat-button:focus-visible,
.launcher-card:focus-visible {
    outline: 3px solid rgba(147, 73, 57, .3);
    outline-offset: 3px;
}

/* Chat Window */

#chat-window {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1100;
    display: none;
    flex-direction: column;
    width: 390px;
    height: 620px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 22px 60px rgba(60, 35, 29, .25);
}

/* Header */

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 78px;
    padding: 16px 18px;
    background: var(--primary);
    color: #fff;
}

.header-info {
    min-width: 0;
}

.header-title {
    margin-bottom: 3px;
    font-size: 17px;
    font-weight: 700;
}

.header-subtitle {
    color: rgba(255,255,255,.82);
    font-size: 13px;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-buttons button {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: .2s ease;
}

.header-buttons button:hover {
    background: rgba(255,255,255,.2);
    transform: translateY(-1px);
}

.header-buttons button:focus-visible {
    outline: 3px solid rgba(255,255,255,.4);
    outline-offset: 2px;
}

/* Chat Content */

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: var(--background);
    scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
    width: 7px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #d8c8c1;
    border-radius: 20px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #c4aea5;
}

/* Privacy Note */

.privacy-note {
    margin-bottom: 18px;
    padding: 10px 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-light);
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
}

/* Bot Messages */

.bot-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-bottom: 16px;
}

.bot-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    background: var(--primary);
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
}

.bot-row > div:last-child {
    max-width: calc(100% - 43px);
}

.bot-bubble {
    padding: 13px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px 16px 16px 16px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
    box-shadow: 0 4px 14px rgba(57,42,36,.06);
}

.bot-bubble strong {
    color: var(--primary);
}

/* User Messages */

.user-bubble {
    width: fit-content;
    max-width: 82%;
    margin: 0 0 16px auto;
    padding: 12px 15px;
    background: var(--primary);
    border-radius: 16px 6px 16px 16px;
    color: #fff;
    font-size: 14px;
    line-height: 1.45;
    box-shadow: 0 5px 14px rgba(147,73,57,.18);
}

.timestamp {
    margin-top: 5px;
    color: #998b85;
    font-size: 10px;
}

.user-bubble .timestamp {
    color: rgba(255,255,255,.72);
    text-align: right;
}

/* Menu Buttons */

.menu-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 20px 43px;
}

.menu-buttons button {
    padding: 10px 18px;
    border: 1px solid var(--primary);
    border-radius: 999px;
    background: var(--surface);
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: .2s ease;
}

.menu-buttons button:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(147, 73, 57, .2);
}

.menu-buttons button:active {
    transform: scale(.98);
}

.menu-buttons button:focus-visible {
    outline: 3px solid rgba(147, 73, 57, .25);
    outline-offset: 2px;
}

/* Responsive */

@media (max-width: 520px) {

    #chat-launcher {
        right: 14px;
        bottom: 14px;
    }

    .launcher-card {
        display: none;
    }

    #chat-window {
        inset: 0;
        width: 100%;
        height: 100%;
        border: none;
        border-radius: 0;
    }

    .chat-header {
        min-height: 74px;
        padding: 14px 16px;
    }

    #chat-messages {
        padding: 16px;
    }

    .menu-buttons {
        margin-left: 0;
    }

    .bot-row > div:last-child {
        max-width: calc(100% - 43px);
    }

}

@media (max-height: 700px) and (min-width: 521px) {

    #chat-window {
        height: calc(100vh - 48px);
    }

}