:root {
    --widget-line: #111;
    --widget-ink: #1d2430;
    --widget-panel: #fffaf0;
    --widget-panel-2: #fff3c4;
    --widget-accent: #8ecae6;
    --widget-shadow: 0 6px 0 rgba(17, 17, 17, 0.22);
}

.floating-chat-launcher,
.floating-chat-shell,
.floating-chat-bubble,
.floating-chat-send,
.floating-chat-select,
.floating-chat-input {
    border: 4px solid var(--widget-line);
    box-shadow: var(--widget-shadow);
}

.floating-chat-launcher {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: var(--widget-accent);
    z-index: 9998;
    cursor: pointer;
}

.floating-chat-launcher::before,
.floating-chat-launcher::after {
    content: "";
    position: absolute;
}

.floating-chat-launcher::before {
    width: 26px;
    height: 18px;
    top: 16px;
    left: 18px;
    border: 4px solid var(--widget-line);
    background: #fff;
}

.floating-chat-launcher::after {
    width: 14px;
    height: 14px;
    left: 28px;
    bottom: 14px;
    background: #fff;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    border-left: 4px solid var(--widget-line);
    border-bottom: 4px solid var(--widget-line);
}

.floating-chat-shell {
    position: fixed;
    right: 18px;
    bottom: 104px;
    width: min(360px, calc(100vw - 24px));
    background: var(--widget-panel);
    z-index: 9999;
    display: none;
}

.floating-chat-shell.open {
    display: block;
}

.floating-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: var(--widget-panel-2);
    border-bottom: 4px solid var(--widget-line);
}

.floating-chat-title {
    margin: 0;
    font-family: "Press Start 2P", monospace;
    font-size: 0.62rem;
    line-height: 1.4;
}

.floating-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.floating-chat-close {
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    color: var(--widget-ink);
}

.floating-chat-reset {
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    color: var(--widget-ink);
}

.floating-chat-controls {
    padding: 12px 14px 0;
    display: grid;
    gap: 8px;
}

.floating-chat-label {
    font-size: 0.86rem;
    color: #5f6875;
}

.floating-chat-select,
.floating-chat-input {
    width: 100%;
    padding: 10px 12px;
    background: #fffdf8;
    color: var(--widget-ink);
    font: inherit;
}

.floating-chat-log {
    max-height: 280px;
    overflow: auto;
    padding: 14px;
    display: grid;
    gap: 10px;
}

.floating-chat-bubble {
    background: #fffdf8;
    padding: 10px 12px;
    font-size: 0.94rem;
    line-height: 1.5;
    color: var(--widget-ink);
}

.floating-chat-bubble.user {
    background: #dff4ff;
}

.floating-chat-bubble.agent {
    background: #fff3c4;
}

.floating-chat-footer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 0 14px 14px;
}

.floating-chat-send {
    background: var(--widget-accent);
    color: var(--widget-ink);
    font-family: "Press Start 2P", monospace;
    font-size: 0.6rem;
    padding: 10px 12px;
    cursor: pointer;
}

.floating-chat-meta {
    padding: 0 14px 12px;
    color: #5f6875;
    font-size: 0.82rem;
}

@media (max-width: 640px) {
    .floating-chat-shell {
        right: 12px;
        bottom: 96px;
        width: calc(100vw - 24px);
    }

    .floating-chat-launcher {
        right: 12px;
        bottom: 12px;
    }
}
