* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    background: #ffffff;
    color: #2f3137;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main {
    min-height: 100vh;
    background:
        radial-gradient(circle at 52% 38%, rgba(246, 248, 251, 0.8), transparent 34%),
        #ffffff;
}

button, input {
    font: inherit;
}

button {
    cursor: pointer;
}

.chatbot-button {
    position: fixed;
    right: 64px;
    bottom: 64px;
    width: 104px;
    height: 104px;
    border: 0;
    border-radius: 50%;
    background: #ff3b2f;
    box-shadow: 0 16px 36px rgba(255, 64, 50, 0.26);
    display: grid;
    place-items: center;
    z-index: 20;
}

.chatbot-button:hover {
    transform: translateY(-2px);
}

.mascot {
    position: relative;
    width: 62px;
    height: 72px;
    display: block;
}

.mascot-face {
    position: absolute;
    left: 5px;
    bottom: 0;
    width: 52px;
    height: 50px;
    border-radius: 22px 22px 18px 18px;
    background: #fff;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.05);
}

.mascot-ear {
    position: absolute;
    top: 0;
    width: 15px;
    height: 34px;
    border-radius: 12px;
    background: #fff;
}

.mascot-ear.left {
    left: 18px;
}

.mascot-ear.right {
    right: 18px;
}

.mascot-eye {
    position: absolute;
    top: 22px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #242832;
}

.mascot-eye.left {
    left: 18px;
}

.mascot-eye.right {
    right: 18px;
}

.mascot-mouth {
    position: absolute;
    left: 19px;
    bottom: 12px;
    width: 14px;
    height: 7px;
    border-radius: 0 0 10px 10px;
    border-bottom: 2px solid #777;
}

.mascot-face::before,
.mascot-face::after {
    content: "";
    position: absolute;
    top: 28px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffb5c2;
}

.mascot-face::before {
    left: 1px;
}

.mascot-face::after {
    right: 1px;
}

.headset {
    position: absolute;
    top: 38px;
    width: 13px;
    height: 21px;
    background: #3d424b;
}

.headset.left {
    left: 0;
    border-radius: 4px 0 0 4px;
}

.headset.right {
    right: 0;
    border-radius: 0 4px 4px 0;
}

.chatbot-panel {
    position: fixed;
    right: 48px;
    bottom: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: min(640px, calc(100vh - 48px));
    background: #f8f8f8;
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(18, 24, 39, 0.22);
    overflow: hidden;
    z-index: 30;
    display: flex;
    flex-direction: column;
}

.chatbot-header {
    height: 68px;
    flex: 0 0 auto;
    background: #202638;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
}

.chatbot-title {
    height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    font-weight: 700;
}

.chat-icon {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: #202638;
    background: #fff;
    font-weight: 800;
    line-height: 1;
}

.chatbot-close {
    position: relative;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
}

.chatbot-close::before,
.chatbot-close::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 21px;
    width: 30px;
    height: 2px;
    background: #fff;
}

.chatbot-close::before {
    transform: rotate(45deg);
}

.chatbot-close::after {
    transform: rotate(-45deg);
}

.chat-date {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    padding: 12px 20px 8px;
    color: #6a6d74;
    font-size: 16px;
    justify-content: center;
}

.chat-date::before,
.chat-date::after {
    content: "";
    height: 1px;
    flex: 1;
    background: #e1e1e1;
}

.chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px 14px;
}

.bot-row,
.user-row {
    display: flex;
    gap: 8px;
    margin-bottom: 13px;
}

.bot-row {
    align-items: flex-start;
}

.user-row {
    justify-content: flex-end;
}

.bot-avatar {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #ff3b2f;
    display: grid;
    place-items: center;
    overflow: hidden;
    margin-top: 2px;
}

.bot-avatar .mascot {
    width: 28px;
    height: 32px;
    transform: none;
}

.bot-avatar .mascot-face {
    left: 3px;
    bottom: 1px;
    width: 22px;
    height: 22px;
    border-radius: 10px 10px 8px 8px;
}

.bot-avatar .mascot-ear {
    top: 0;
    width: 7px;
    height: 16px;
    border-radius: 6px;
}

.bot-avatar .mascot-ear.left {
    left: 8px;
}

.bot-avatar .mascot-ear.right {
    right: 8px;
}

.bot-avatar .mascot-eye {
    top: 10px;
    width: 3px;
    height: 3px;
}

.bot-avatar .mascot-eye.left {
    left: 8px;
}

.bot-avatar .mascot-eye.right {
    right: 8px;
}

.bot-avatar .mascot-mouth {
    left: 8px;
    bottom: 5px;
    width: 7px;
    height: 4px;
    border-bottom-width: 1px;
}

.bot-avatar .mascot-face::before,
.bot-avatar .mascot-face::after {
    top: 13px;
    width: 6px;
    height: 6px;
}

.bot-avatar .headset {
    top: 17px;
    width: 6px;
    height: 10px;
}

.bubble {
    max-width: calc(100% - 44px);
    border-radius: 18px;
    padding: 12px 14px;
    line-height: 1.38;
    font-size: 14px;
    white-space: normal;
}

.bot-bubble {
    background: #fff;
    border: 1px solid #ececec;
    border-top-left-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
    word-break: keep-all;
    width: fit-content;
}

.answer-text {
    max-width: 100%;
}

.answer-text p {
    margin: 0 0 8px;
}

.answer-text p:last-child {
    margin-bottom: 0;
}

.answer-text ul {
    margin: 4px 0 10px;
    padding-left: 18px;
}

.answer-text li {
    margin: 0 0 5px;
}

.answer-text strong {
    font-weight: 800;
}

.user-bubble {
    background: #fff2bd;
    border: 1px solid #ffe188;
    border-top-right-radius: 8px;
    font-weight: 700;
}

.welcome-card {
    max-width: 270px;
    min-height: 0;
    text-align: left;
    line-height: 1.42;
}

.welcome-card p {
    margin: 0 0 8px;
}

.welcome-card p:last-child {
    margin-bottom: 0;
}

.welcome-card strong {
    font-weight: 800;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 8px 0 14px 44px;
}

.quick-button {
    min-height: 58px;
    border: 1px solid #e7e7e7;
    border-radius: 14px;
    background: #fff;
    color: #444;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.quick-button[disabled] {
    color: #a3a5aa;
    background: #f2f2f2;
    cursor: default;
}

.question-list-bubble {
    width: min(100%, 280px);
}

.question-list-intro p {
    margin: 0 0 6px;
}

.question-list-intro p:last-child {
    margin-bottom: 10px;
    color: #676b74;
}

.question-list {
    display: grid;
    gap: 7px;
}

.question-list-button {
    width: 100%;
    min-height: 42px;
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 8px;
    align-items: center;
    border: 1px solid #ececec;
    border-radius: 10px;
    background: #fff;
    color: #30333b;
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.32;
    word-break: keep-all;
}

.question-list-button:hover,
.question-list-button:focus {
    border-color: #ffb2b5;
    background: #fff8f8;
}

.question-list-button span {
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: #ff4a4f;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

.citation-list {
    margin-top: 12px;
    display: grid;
    gap: 8px;
}

.citation-card {
    border-left: 4px solid #ff4a4f;
    background: #fafafa;
    border-radius: 8px;
    padding: 9px 11px;
    font-size: 13px;
    line-height: 1.35;
}

.citation-card span {
    display: block;
    margin-bottom: 3px;
    color: #858891;
    font-size: 12px;
    font-weight: 800;
}

.citation-card strong {
    display: block;
    color: #343741;
}

.citation-card a {
    display: inline-block;
    margin-top: 5px;
    color: #d83238;
    font-weight: 700;
}

.feedback-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.feedback-actions button {
    min-height: 32px;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    background: #fff;
    color: #3b3d44;
    padding: 0 10px;
    font-size: 13px;
    font-weight: 700;
}

.feedback-actions button:disabled {
    color: #999;
    background: #f3f3f3;
    cursor: default;
}

.feedback-status {
    color: #777;
    font-size: 13px;
    font-weight: 700;
}

.chat-form {
    height: 76px;
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 38px 1fr 42px;
    gap: 6px;
    align-items: center;
    padding: 10px 16px 16px;
    background: #f8f8f8;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.chat-plus {
    border: 0;
    background: transparent;
    color: #777;
    font-size: 34px;
    line-height: 1;
}

.chat-form input {
    width: 100%;
    height: 48px;
    border: 1px solid #ddd;
    border-radius: 28px;
    padding: 0 16px;
    background: #fff;
    color: #333;
    font-size: 14px;
    outline: none;
}

.chat-send {
    position: relative;
    width: 42px;
    height: 48px;
    border: 0;
    background: transparent;
}

.chat-send::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 13px;
    width: 22px;
    height: 22px;
    border-top: 4px solid #8a8a8a;
    border-right: 4px solid #8a8a8a;
    transform: rotate(45deg) skew(-12deg, -12deg);
}

.loading {
    color: #777;
}

@media (max-width: 640px) {
    .chatbot-button {
        right: 36px;
        bottom: 36px;
        width: 86px;
        height: 86px;
    }

    .chatbot-panel {
        inset: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .quick-grid {
        grid-template-columns: repeat(4, 1fr);
        margin-left: 0;
    }

    .quick-button {
        min-height: 72px;
    }

    .bubble {
        max-width: 86%;
    }
}
