.site-chatbot {
    position: fixed;
    z-index: 90;
    bottom: max(0.4rem, env(safe-area-inset-bottom));
    inset-inline-end: max(1rem, env(safe-area-inset-right));
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.65rem;
    pointer-events: none;
}

.site-chatbot-launcher,
.site-chatbot-panel,
.site-chatbot-panel * {
    pointer-events: auto;
}

.site-chatbot-launcher {
    position: relative;
    width: 4.4rem;
    height: 4.4rem;
    padding: 0.38rem;
    border: 0;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, #fff, #e8f2ff 62%, #d5e7fb);
    box-shadow:
        0 0 0 4px rgba(28, 99, 179, 0.12),
        0 0 0 1px rgba(28, 99, 179, 0.22),
        0 10px 18px rgba(17, 40, 71, 0.16);
    cursor: pointer;
    z-index: 2;
}

.site-chatbot-ring {
    position: absolute;
    inset: -0.28rem;
    border-radius: 50%;
    border: 1.5px dashed rgba(28, 99, 179, 0.45);
    pointer-events: none;
}

.site-chatbot-lottie,
.site-chatbot-launcher dotlottie-wc {
    display: block;
    width: 100%;
    height: 100%;
}

.site-chatbot-lottie {
    position: relative;
    z-index: 1;
    border-radius: 50%;
    overflow: hidden;
    transform: scale(1);
}

.site-chatbot-fallback {
    position: absolute;
    inset: 0.5rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: transparent;
    color: var(--brand);
    z-index: 0;
}

.site-chatbot.is-open .site-chatbot-launcher {
    display: none;
}

body.chat-sheet-open { overflow: hidden; }

.site-chatbot-scrim {
    position: fixed;
    z-index: 90;
    inset: 0;
    top: var(--header-height, 3.5rem);
    border: 0;
    padding: 0;
    background: rgba(7, 18, 32, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.42s ease;
}

.site-chatbot.is-open .site-chatbot-scrim {
    opacity: 1;
    pointer-events: auto;
}

.site-chatbot-panel {
    position: fixed;
    z-index: 91;
    inset-inline-end: 0;
    bottom: 0;
    width: min(40rem, calc(100vw - 2rem));
    height: min(42rem, calc(100dvh - var(--header-height, 3.5rem)));
    max-height: calc(100dvh - var(--header-height, 3.5rem));
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 1.35rem 1.35rem 0 0;
    border-bottom: 0;
    background: #fff;
    border: 1px solid rgba(28, 99, 179, 0.16);
    box-shadow: 0 -18px 48px rgba(17, 40, 71, 0.22);
    color: var(--ink);
    transform: translate3d(0, 110%, 0);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.44s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.44s;
}


.site-chatbot.is-open .site-chatbot-panel {
    transform: translate3d(0, 0, 0);
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.44s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}

.site-chatbot-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    padding: 0.65rem 0.75rem 0;
    background: #f7fbff;
}

.site-chatbot-tabs button {
    min-height: 2.4rem;
    border: 1px solid rgba(28, 99, 179, 0.14);
    border-radius: 0.8rem;
    background: #fff;
    color: var(--ink-muted);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
}

.site-chatbot-tabs button.is-active {
    background: #1c63b3;
    border-color: #1c63b3;
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .site-chatbot-panel,
    .site-chatbot-scrim { transition: none; }
}

.site-chatbot-head,
.site-chatbot-tabs,
.site-chatbot-suggest,
.site-chatbot-form { flex-shrink: 0; }

.site-chatbot-pane {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.site-chatbot-pane[hidden] { display: none; }

.partner-list,
.partner-room {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1;
    min-height: 0;
    padding: 0.75rem;
}

.partner-room[hidden],
.partner-list[hidden] { display: none; }

.partner-item {
    display: grid;
    gap: 0.15rem;
    width: 100%;
    text-align: start;
    padding: 0.75rem 0.85rem;
    border-radius: 0.95rem;
    border: 1px solid rgba(28, 99, 179, 0.14);
    background: #fff;
    cursor: pointer;
}

.partner-item { position: relative; }
.partner-item strong { color: var(--ink); font-size: 0.92rem; }
.partner-item span { color: var(--ink-muted); font-size: 0.78rem; }
.partner-item .chat-badge { top: 0.55rem; inset-inline-start: auto; inset-inline-end: 0.55rem; }
.partner-empty { margin: 0.5rem; color: var(--ink-muted); line-height: 1.7; }
.partner-back {
    align-self: flex-end;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0;
    margin-right: auto;
    border: 0;
    background: transparent;
    color: var(--brand);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.partner-topic-line {
    margin: 0;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(28, 99, 179, 0.08);
    color: #1c63b3;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
}
.partner-line {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
    max-width: 92%;
}
.partner-line.is-mine { margin-left: auto; }
.partner-line.is-peer { margin-right: auto; flex-direction: row-reverse; }
.partner-stack { display: grid; gap: 0.12rem; min-width: 0; }
.partner-line .site-chatbot-msg { max-width: 100%; }
.partner-time {
    color: var(--ink-muted);
    font-size: 0.68rem;
    font-weight: 600;
}
.partner-line.is-mine .partner-time { text-align: right; }
.partner-line.is-peer .partner-time { text-align: left; }
.partner-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 0.55rem 0.85rem;
    border-radius: 1.15rem;
    background:
        radial-gradient(circle at 50% 0%, rgba(28, 99, 179, 0.16), transparent 58%),
        #f7fafd;
    border: 1px solid rgba(28, 99, 179, 0.12);
}
.partner-stage[hidden] { display: none; }
.partner-face {
    display: grid;
    justify-items: center;
    gap: 0.35rem;
    margin: 0;
    min-width: 0;
}
.partner-avatar {
    width: clamp(3.1rem, 18vw, 4.2rem);
    height: clamp(3.1rem, 18vw, 4.2rem);
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #e4f1ff;
    color: #1c63b3;
    font-weight: 800;
    font-size: 1.15rem;
    border: 3px solid #fff;
    box-shadow: 0 0 0 3px rgba(28, 99, 179, 0.2), 0 8px 16px rgba(17, 40, 71, 0.12);
}
.partner-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.partner-avatar.is-mini {
    width: 2.6rem;
    height: 2.6rem;
    font-size: 0.9rem;
    border-width: 2px;
    box-shadow: 0 0 0 2px rgba(28, 99, 179, 0.16);
    flex: 0 0 auto;
}
.partner-face figcaption {
    max-width: 100%;
    font-size: 0.78rem;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.partner-bond {
    display: grid;
    place-items: center;
    min-width: 5.5rem;
    max-width: 8rem;
    padding: 0.45rem 0.55rem;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(28, 99, 179, 0.16);
    box-shadow: 0 8px 16px rgba(28, 99, 179, 0.08);
}
.partner-bond span {
    font-size: 0.72rem;
    font-weight: 800;
    text-align: center;
    line-height: 1.45;
    color: #1c63b3;
}
.partner-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.partner-item-copy { display: grid; gap: 0.12rem; min-width: 0; }
.partner-item-copy em {
    font-style: normal;
    color: var(--ink-muted);
    font-size: 0.78rem;
}
[data-theme="dark"] .partner-stage { background: #0b1524; }
[data-theme="dark"] .partner-avatar { background: #17304a; color: #8cc0f7; border-color: #112033; }
[data-theme="dark"] .partner-bond { background: #112033; }
.partner-room .site-chatbot-log { flex: 1; min-height: 12rem; padding: 0.4rem 0; background: transparent; }

[data-theme="dark"] .site-chatbot-tabs { background: #0b1524; }
[data-theme="dark"] .site-chatbot-tabs button { background: #112033; color: #d5e4f2; }
[data-theme="dark"] .partner-item { background: #112033; }

.site-chatbot-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 1.15rem 0.9rem 0.85rem;
    background:
        radial-gradient(circle at 0% 0%, rgba(61, 143, 239, 0.45), transparent 42%),
        linear-gradient(145deg, #0d213c, #1c63b3 70%);
    color: #fff;
}

.site-chatbot-head::before {
    content: "";
    position: absolute;
    top: 0.42rem;
    left: 50%;
    width: 2.6rem;
    height: 0.28rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.45);
    transform: translateX(-50%);
}

.site-chatbot-head-anim {
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
}

.site-chatbot-head-copy { min-width: 0; }

.site-chatbot-head strong {
    display: block;
    font-size: 1rem;
    font-weight: 800;
}

.site-chatbot-head small {
    display: block;
    margin-top: 0.12rem;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.75rem;
}

.site-chatbot-close {
    margin-inline-start: auto;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.site-chatbot-log {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    flex: 1;
    min-height: 16rem;
    overflow: auto;
    padding: 1rem 0.9rem;
    background: #f4f8fc;
}

.site-chatbot-msg {
    width: fit-content;
    max-width: 86%;
    padding: 0.7rem 0.85rem;
    border-radius: 1.05rem;
    font-size: 0.92rem;
    line-height: 1.75;
    box-shadow: 0 8px 18px rgba(17, 40, 71, 0.06);
}

.site-chatbot-msg p { margin: 0; }

.site-chatbot-msg.is-user {
    margin-left: auto;
    margin-right: 0;
    align-self: flex-start;
    background: linear-gradient(145deg, #1c63b3, #1578e3);
    color: #fff;
    border-bottom-right-radius: 0.28rem;
}

.site-chatbot-msg.is-bot {
    margin-right: auto;
    margin-left: 0;
    align-self: flex-end;
    background: #fff;
    border: 1px solid rgba(28, 99, 179, 0.1);
    border-bottom-left-radius: 0.28rem;
}

.site-chatbot-msg a {
    display: inline-flex;
    margin-top: 0.4rem;
    color: var(--brand);
    font-weight: 800;
    text-decoration: none;
}

.site-chatbot-msg.is-user a { color: #fff; }

.chat-login {
    margin-top: 0.65rem;
    padding: 0.8rem 0.85rem 0.85rem;
    border-radius: 0.95rem;
    background: linear-gradient(180deg, #eef5fc 0%, #fff 70%);
    border: 1px solid rgba(28, 99, 179, 0.18);
}

.chat-login strong {
    display: block;
    color: #1c63b3;
    font-size: 0.95rem;
}

.chat-login p {
    margin: 0.28rem 0 0.7rem;
    color: var(--ink-muted);
    font-size: 0.82rem;
    line-height: 1.7;
}

.site-chatbot-msg .chat-login-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    padding: 0.48rem 0.95rem;
    border-radius: 999px;
    background: #1c63b3;
    color: #fff;
    font-size: 0.86rem;
    font-weight: 800;
}

.site-chatbot-msg .chat-login-btn:hover {
    background: #164f90;
    text-decoration: none;
}

.chat-cards { display: grid; gap: 0.45rem; margin-top: 0.45rem; }

.chat-card {
    display: grid;
    gap: 0.12rem;
    padding: 0.55rem 0.65rem;
    border-radius: 0.8rem;
    background: rgba(28, 99, 179, 0.06);
    border: 1px solid rgba(28, 99, 179, 0.1);
}

.chat-card strong { font-size: 0.88rem; }
.chat-card span,
.chat-card em { font-style: normal; color: var(--ink-muted); font-size: 0.78rem; }
.chat-card b { color: var(--brand); font-size: 0.95rem; }

.site-chatbot-form button {
    width: 2.7rem;
    border: 0;
    border-radius: 0.85rem;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.site-chatbot-msg a:hover { text-decoration: underline; }

.site-chatbot-suggest {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem 0.75rem;
    background: var(--bg-0);
}

.site-chatbot-suggest button {
    min-width: 0;
    min-height: 2.7rem;
    border: 1px solid rgba(28, 99, 179, 0.18);
    background: linear-gradient(180deg, #fff, #eef5fc);
    color: #1c63b3;
    border-radius: 0.95rem;
    padding: 0.4rem 0.65rem;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.45;
    white-space: normal;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(28, 99, 179, 0.08);
}

.site-chatbot-suggest button:hover {
    border-color: rgba(28, 99, 179, 0.4);
    transform: translateY(-1px);
}

.chat-card {
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem 0.8rem 0.7rem;
    border-radius: 1rem;
    background:
        linear-gradient(#fff, #fff) padding-box,
        linear-gradient(135deg, rgba(28, 99, 179, 0.45), rgba(61, 143, 239, 0.15)) border-box;
    border: 1px solid transparent;
    box-shadow: 0 10px 22px rgba(17, 40, 71, 0.06);
}

.chat-card.is-pending {
    background:
        linear-gradient(#fffaf3, #fff) padding-box,
        linear-gradient(135deg, #f59e0b, rgba(28, 99, 179, 0.35)) border-box;
}

.chat-card.is-accepted {
    background:
        linear-gradient(#f3fbf8, #fff) padding-box,
        linear-gradient(135deg, #0f8f8e, rgba(28, 99, 179, 0.2)) border-box;
}

.chat-card strong { font-size: 0.92rem; }
.chat-card span,
.chat-card em { font-style: normal; color: var(--ink-muted); font-size: 0.78rem; }
.chat-card b {
    justify-self: start;
    margin-top: 0.25rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(28, 99, 179, 0.1);
    color: var(--brand);
    font-size: 1rem;
    letter-spacing: 0.04em;
}
.chat-card.is-pending em { color: #b45309; font-weight: 800; }

.site-chatbot-form {
    display: flex;
    gap: 0.4rem;
    padding: 0.7rem;
    border-top: 1px solid var(--card-border);
    background: #fff;
}

.site-chatbot-form input {
    flex: 1;
    min-width: 0;
    min-height: 2.6rem;
    border: 1px solid rgba(28, 99, 179, 0.16);
    border-radius: 0.75rem;
    background: var(--input-bg);
    color: var(--ink);
    font: inherit;
    font-size: 0.88rem;
    padding: 0.4rem 0.7rem;
    outline: none;
}

.site-chatbot-form input:focus {
    border-color: rgba(28, 99, 179, 0.45);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.site-chatbot-form button {
    width: 2.7rem;
    border: 0;
    border-radius: 0.85rem;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
}

[data-theme="dark"] .site-chatbot-msg.is-bot,
[data-theme="dark"] .site-chatbot-suggest button {
    background: #112033;
    color: var(--ink);
    border-color: rgba(140, 192, 247, 0.16);
}
[data-theme="dark"] .site-chatbot-suggest button {
    background: linear-gradient(180deg, #17304a, #112033);
    color: #8cc0f7;
}

[data-theme="dark"] .site-chatbot-suggest button { color: #8cc0f7; }
[data-theme="dark"] .site-chatbot-msg a { color: #8cc0f7; }
[data-theme="dark"] .chat-login {
    background: linear-gradient(180deg, #17304a, #112033);
    border-color: rgba(140, 192, 247, 0.22);
}
[data-theme="dark"] .chat-login strong { color: #8cc0f7; }
[data-theme="dark"] .site-chatbot-msg .chat-login-btn {
    background: #1c63b3;
    color: #fff;
}
.chat-badge {
    position: absolute;
    top: 0.15rem;
    inset-inline-start: 0.15rem;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: #d92d20;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-grid;
    place-items: center;
    z-index: 2;
}
.site-chatbot-tabs button { position: relative; }
.site-chatbot-tabs .chat-badge {
    position: static;
    margin-inline-start: 0.35rem;
}
[data-theme="dark"] .site-chatbot-panel,
[data-theme="dark"] .site-chatbot-form,
[data-theme="dark"] .site-chatbot-log { background: #0b1524; }
[data-theme="dark"] .site-chatbot-panel,
[data-theme="dark"] .site-chatbot-form { background: #112033; }

@media (max-width: 767.98px) {
    .site-chatbot {
        bottom: max(0.35rem, env(safe-area-inset-bottom));
        inset-inline-end: 0.7rem;
    }

    .site-chatbot-launcher {
        width: 3.8rem;
        height: 3.8rem;
        padding: 0.32rem;
    }

    .site-chatbot-panel {
        inset-inline: 0;
        width: 100%;
        height: calc(100dvh - var(--header-height, 3.5rem));
        max-height: calc(100dvh - var(--header-height, 3.5rem));
        border-radius: 1.2rem 1.2rem 0 0;
    }

    .site-chatbot-form {
        padding-bottom: max(0.7rem, env(safe-area-inset-bottom));
    }

    .site-chatbot-log { min-height: 12rem; }
    .site-chatbot-msg { font-size: 0.95rem; }
    .site-chatbot-form input { font-size: 1rem; min-height: 2.85rem; }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
