* {
    box-sizing: border-box;
}

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

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #111827;
}

button {
    font: inherit;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.public-chat-body {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(18, 140, 126, 0.18) 0 128px, transparent 128px),
        radial-gradient(circle at 20% 10%, rgba(37, 99, 235, 0.14), transparent 28%),
        #e7edf2;
}

.public-chat-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px;
}

.public-chat-window {
    display: grid;
    width: min(1080px, 100%);
    min-height: min(760px, calc(100vh - 56px));
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 12px;
    background: #f5f7fb;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.public-chat-header {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 74px;
    border-bottom: 1px solid #d8e0e8;
    background: #f8fafc;
    padding: 14px 18px;
}

.public-chat-avatar {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    border-radius: 50%;
    background: #128c7e;
    color: #ffffff;
    font-size: 19px;
    font-weight: 800;
}

.public-chat-header h1,
.public-chat-header span {
    display: block;
    margin: 0;
}

.public-chat-header h1 {
    max-width: 58vw;
    overflow: hidden;
    color: #111827;
    font-size: 17px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.public-chat-header span {
    margin-top: 3px;
    color: #15803d;
    font-size: 13px;
}

.public-chat-reset {
    min-height: 38px;
    margin-left: auto;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    padding: 0 14px;
}

.public-chat-reset:hover,
.public-chat-reset:focus-visible {
    border-color: #128c7e;
    color: #0f766e;
}

.public-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    background:
        linear-gradient(rgba(245, 247, 251, 0.86), rgba(245, 247, 251, 0.86)),
        repeating-linear-gradient(45deg, rgba(18, 140, 126, 0.08) 0 1px, transparent 1px 18px);
    padding: 26px;
}

.public-chat-bubble {
    width: fit-content;
    max-width: min(680px, 82%);
    border-radius: 10px;
    color: #111827;
    line-height: 1.5;
    overflow-wrap: anywhere;
    padding: 12px 14px;
    white-space: pre-line;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.09);
}

.public-chat-bubble.bot {
    align-self: flex-start;
    border-top-left-radius: 3px;
    background: #ffffff;
}

.public-chat-bubble.user {
    align-self: flex-end;
    border-top-right-radius: 3px;
    background: #d9fdd3;
}

.public-chat-bubble.final {
    align-self: flex-start;
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.public-chat-options {
    display: flex;
    width: fit-content;
    max-width: min(720px, 92%);
    flex-wrap: wrap;
    gap: 8px;
    align-self: flex-start;
    border-radius: 10px;
    border-top-left-radius: 3px;
    background: #ffffff;
    padding: 10px;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.08);
}

.public-chat-option {
    max-width: 100%;
    border: 1px solid #99f6e4;
    border-radius: 999px;
    background: #ecfeff;
    color: #0f766e;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
    padding: 10px 13px;
    text-align: left;
}

.public-chat-option:hover,
.public-chat-option:focus-visible {
    border-color: #128c7e;
    background: #ccfbf1;
}

.public-chat-option:disabled {
    cursor: default;
    opacity: 0.58;
}

.public-chat-state {
    width: min(520px, 100%);
    margin: auto;
    border: 1px solid #d7dee8;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.86);
    padding: 24px;
    text-align: center;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
}

.public-chat-state strong {
    display: block;
    margin-bottom: 8px;
    font-size: 18px;
}

.public-chat-state p {
    margin: 0;
    color: #64748b;
    line-height: 1.5;
}

.public-chat-footer {
    display: flex;
    align-items: center;
    min-height: 58px;
    border-top: 1px solid #d8e0e8;
    background: #f8fafc;
    padding: 12px 18px;
}

.public-chat-input-form {
    display: flex;
    width: 100%;
    gap: 10px;
}

.public-chat-input-form input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d8e0e8;
    border-radius: 999px;
    background: #ffffff;
    color: #111827;
    font-size: 14px;
    outline: none;
    padding: 12px 16px;
}

.public-chat-input-form input:focus {
    border-color: #128c7e;
    box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.12);
}

.public-chat-input-form button {
    min-height: 44px;
    border: 0;
    border-radius: 999px;
    background: #128c7e;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    padding: 0 18px;
}

.public-chat-input-form button:hover,
.public-chat-input-form button:focus-visible {
    background: #0f766e;
}

@media (max-width: 720px) {
    .public-chat-page {
        display: block;
        padding: 0;
    }

    .public-chat-window {
        width: 100%;
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .public-chat-header {
        min-height: 68px;
        padding: 12px;
    }

    .public-chat-avatar {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
        font-size: 17px;
    }

    .public-chat-header h1 {
        max-width: 44vw;
        font-size: 16px;
    }

    .public-chat-reset {
        min-height: 34px;
        font-size: 13px;
        padding: 0 10px;
    }

    .public-chat-messages {
        padding: 16px 12px;
    }

    .public-chat-bubble {
        max-width: 88%;
    }

    .public-chat-options {
        max-width: 96%;
    }

    .public-chat-footer {
        min-height: 52px;
        padding: 10px 12px;
    }

    .public-chat-input-form {
        gap: 8px;
    }

    .public-chat-input-form input,
    .public-chat-input-form button {
        min-height: 40px;
    }

    .public-chat-input-form button {
        padding: 0 12px;
    }
}
