.gcw-root,
.gcw-root * {
    box-sizing: border-box;
}

.gcw-root {
    --gcw-bg: linear-gradient(180deg, #fffdf8 0%, #f4eee3 100%);
    --gcw-panel: rgba(255, 255, 255, 0.96);
    --gcw-border: rgba(76, 59, 40, 0.14);
    --gcw-shadow: 0 26px 80px rgba(37, 28, 18, 0.22);
    --gcw-text: #2f241a;
    --gcw-muted: #837160;
    --gcw-accent: #2a2019;
    --gcw-accent-soft: #efe2d4;
    --gcw-guest: #2f241a;
    --gcw-agent: #f5eee5;
    --gcw-agent-border: rgba(68, 53, 38, 0.1);
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 1270;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    font-family: 'Roboto Condensed', sans-serif;
}

.gcw-launcher,
.gcw-panel {
    pointer-events: auto;
}

.gcw-launcher {
    display: none;
    width: 66px;
    height: 66px;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #3e3025 0%, #181311 74%);
    color: #fff;
    box-shadow: 0 18px 45px rgba(25, 20, 16, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.gcw-launcher:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 22px 48px rgba(25, 20, 16, 0.34);
}

.gcw-launcher:focus-visible,
.gcw-icon-btn:focus-visible,
.gcw-send:focus-visible,
.gcw-aux-btn:focus-visible,
.gcw-textarea:focus-visible,
.gcw-contact-input:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.gcw-launcher svg,
.gcw-icon-btn svg,
.gcw-send svg,
.gcw-aux-btn svg {
    width: 24px;
    height: 24px;
}

.gcw-panel {
    width: min(392px, calc(100vw - 24px));
    height: min(640px, calc(100vh - 96px));
    border-radius: 28px;
    border: 1px solid var(--gcw-border);
    background: var(--gcw-bg);
    box-shadow: var(--gcw-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(18px) scale(0.96);
    transform-origin: bottom right;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.gcw-root--open .gcw-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.gcw-root--open .gcw-launcher {
    opacity: 0;
    transform: translateY(8px) scale(0.92);
    pointer-events: none;
}

.gcw-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 14px;
}

.gcw-title-wrap {
    min-width: 0;
}

.gcw-title {
    margin: 0;
    color: var(--gcw-text);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.05;
}

.gcw-subtitle {
    margin-top: 6px;
    color: var(--gcw-muted);
    font-size: 14px;
    line-height: 1.3;
}

.gcw-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.gcw-icon-btn {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #5d5043;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.gcw-icon-btn:hover {
    background: rgba(53, 39, 28, 0.08);
    color: #1f1712;
}

.gcw-body {
    flex: 1;
    min-height: 0;
    padding: 0 14px 8px;
}

.gcw-log {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding: 6px 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}

.gcw-log::-webkit-scrollbar {
    width: 8px;
}

.gcw-log::-webkit-scrollbar-thumb {
    background: rgba(90, 68, 46, 0.18);
    border-radius: 999px;
}

.gcw-empty {
    margin: auto 0;
    padding: 34px 18px;
    text-align: center;
    color: var(--gcw-text);
}

.gcw-empty-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.gcw-empty-copy {
    margin-top: 10px;
    color: var(--gcw-muted);
    font-size: 14px;
    line-height: 1.45;
}

.gcw-row {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    gap: 6px;
}

.gcw-row--guest {
    align-self: flex-end;
    align-items: flex-end;
}

.gcw-row--agent {
    align-self: flex-start;
    align-items: flex-start;
}

.gcw-bubble {
    width: fit-content;
    max-width: 100%;
    border-radius: 20px;
    padding: 12px 14px 11px;
    line-height: 1.42;
    font-size: 15px;
    white-space: pre-wrap;
    word-break: break-word;
}

.gcw-row--guest .gcw-bubble {
    background: var(--gcw-guest);
    color: #fff;
    border-bottom-right-radius: 8px;
}

.gcw-row--agent .gcw-bubble {
    background: var(--gcw-agent);
    color: var(--gcw-text);
    border: 1px solid var(--gcw-agent-border);
    border-bottom-left-radius: 8px;
}

.gcw-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--gcw-muted);
    padding: 0 4px;
}

.gcw-author {
    font-weight: 700;
}

.gcw-status {
    padding: 6px 18px 0;
    min-height: 24px;
    color: var(--gcw-muted);
    font-size: 13px;
    line-height: 1.35;
}

.gcw-status--error {
    color: #b2342f;
}

.gcw-status--ok {
    color: #2c7a4b;
}

.gcw-composer {
    padding: 10px 14px 14px;
}

.gcw-contact-box {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(81, 63, 44, 0.12);
}

.gcw-contact-box--open {
    display: grid;
}

.gcw-contact-box .gcw-contact-input--wide {
    grid-column: 1 / -1;
}

.gcw-contact-note {
    grid-column: 1 / -1;
    color: var(--gcw-muted);
    font-size: 12px;
    line-height: 1.35;
}

.gcw-contact-input,
.gcw-textarea {
    width: 100%;
    border: 1px solid rgba(81, 63, 44, 0.16);
    background: rgba(255, 255, 255, 0.96);
    color: var(--gcw-text);
    border-radius: 16px;
    padding: 12px 14px;
    font: inherit;
}

.gcw-contact-input::placeholder,
.gcw-textarea::placeholder {
    color: #9f9182;
}

.gcw-textarea {
    min-height: 60px;
    max-height: 138px;
    resize: none;
}

.gcw-compose-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    gap: 10px;
    align-items: end;
}

.gcw-aux-btn,
.gcw-send {
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.gcw-aux-btn {
    background: rgba(255, 255, 255, 0.88);
    color: var(--gcw-text);
    border: 1px solid rgba(81, 63, 44, 0.12);
}

.gcw-send {
    background: #1f1a17;
    color: #fff;
    box-shadow: 0 12px 30px rgba(22, 17, 13, 0.22);
}

.gcw-aux-btn:hover,
.gcw-send:hover {
    transform: translateY(-1px);
}

.gcw-aux-btn:disabled,
.gcw-send:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.gcw-footnote {
    padding-top: 8px;
    text-align: center;
    color: var(--gcw-muted);
    font-size: 12px;
    line-height: 1.35;
}

.gcw-spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(47, 36, 26, 0.16);
    border-top-color: rgba(47, 36, 26, 0.8);
    animation: gcw-spin 0.8s linear infinite;
    margin: 22px auto;
}

@keyframes gcw-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    .gcw-root {
        right: max(12px, env(safe-area-inset-right));
        bottom: max(12px, env(safe-area-inset-bottom));
    }

    .gcw-panel {
        width: min(100vw - 16px, 420px);
        height: min(74vh, 620px);
        border-radius: 24px;
    }

    .gcw-header {
        padding: 16px 16px 12px;
    }

    .gcw-title {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .gcw-panel {
        width: calc(100vw - 12px);
        height: min(82vh, 680px);
        border-radius: 22px;
    }

    .gcw-row {
        max-width: 88%;
    }

    .gcw-contact-box {
        grid-template-columns: 1fr;
    }
}
