/* XSSR Academy Support — presentation adapted from the design handoff. */
.cw-root {
    --cw-accent: #c00;
    --cw-hover: #a50000;
    --cw-focus: #a50000;
    --cw-header-bg: #1e1e1e;
    --cw-header-fg: #fff;
    --cw-bg: #fff;
    --cw-fg: #181818;
    --cw-muted: #5f5957;
    --cw-border: #dad4ce;
    --cw-field-border: #a7a09a;
    --cw-paper: #f5f3ef;
    --cw-out-bg: #f3f4f6;
    --cw-bot-bg: #f5f3ef;
    --cw-own-bg: #fff0ee;
    --cw-own-line: #efc5c0;
    --cw-danger: #a50000;
    --cw-edge: clamp(17px, 3vw, 42px);
    --cw-bottom: max(23px, env(safe-area-inset-bottom));
    font: 15px/1.45 Jost, system-ui, sans-serif;
}

.cw-root[data-theme="dark"] {
    --cw-accent: #c00;
    --cw-focus: #ff9d9d;
    --cw-header-bg: #1e1e1e;
    --cw-paper: #282322;
    --cw-bot-bg: #302a26;
    --cw-own-bg: #442523;
    --cw-own-line: #80514c;
    --cw-field-border: #887d78;
    --cw-muted: #c4b8b3;
}

.cw-root .cw-launcher {
    right: max(var(--cw-edge), env(safe-area-inset-right));
    bottom: var(--cw-bottom);
    width: auto;
    height: 54px;
    gap: 10px;
    padding: 0 18px;
    border-radius: 100px;
    font-weight: 650;
    box-shadow: 0 8px 23px #42060742;
    transition: none;
}
.cw-root .cw-launcher:hover { background: var(--cw-hover); transform: none; }
.cw-root .cw-badge {
    position: static;
    padding: 0 5px;
    border: 0;
    background: #fff;
    color: #a50000;
    line-height: 22px;
}

.cw-root .cw-panel {
    right: max(var(--cw-edge), env(safe-area-inset-right));
    bottom: var(--cw-bottom);
    width: min(calc(100vw - 34px), 425px);
    max-width: none;
    height: min(639px, calc(100vh - var(--cw-bottom) - 20px));
    height: min(639px, calc(100dvh - var(--cw-bottom) - 20px));
    box-shadow: 0 24px 80px #25111149;
}
.cw-root .cw-header { min-height: 73px; padding: 10px 13px 10px 17px; gap: 11px; }
.cw-root .cw-title { font-weight: 650; line-height: 1.24; letter-spacing: -.02em; text-transform: none; }
.cw-root .cw-close { width: 44px; height: 44px; border-radius: 9px; }
.cw-root .cw-header :focus-visible { outline-color: #ff9d9d; }
.cw-root .cw-brand {
    width: 40px;
    height: 40px;
    background: transparent url('/assets/themes/xssr/img/apple-touch-icon.png') center / contain no-repeat;
}

.cw-root .cw-thread {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 17px;
}
.cw-root .cw-thread:focus-visible { outline-offset: -3px; }
.cw-root .cw-welcome { display: grid; align-content: center; justify-items: start; min-height: 100%; padding: 16px 8px 24px; }
.cw-root .cw-welcome-icon {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border: 1px solid var(--cw-own-line);
    border-radius: 14px;
    background: var(--cw-own-bg);
    color: var(--cw-focus);
}
.cw-root .cw-welcome-title { margin: 17px 0 6px; font-size: 29px; }
.cw-root .cw-welcome-text { max-width: none; }
.cw-root .cw-topics { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.cw-root .cw-topic { max-width: 100%; overflow-wrap: anywhere; background: var(--cw-paper); border-color: var(--cw-border); }
.cw-root .cw-topic:hover { background: var(--cw-own-bg); border-color: var(--cw-focus); }

.cw-root .cw-log { overflow: visible; padding: 0; gap: 13px; }
.cw-root .cw-msg { max-width: 92%; padding: 0; color: var(--cw-fg); background: none; outline: none; font-size: 15px; }
.cw-root .cw-msg-text {
    display: block;
    padding: 11px 13px;
    border: 1px solid var(--cw-border);
    border-radius: 14px 14px 14px 4px;
    background: var(--cw-out-bg);
}
.cw-root .cw-msg--in .cw-msg-text { border-radius: 14px 14px 4px 14px; border-color: var(--cw-own-line); background: var(--cw-own-bg); }
.cw-root .cw-msg--bot .cw-msg-text { background: var(--cw-bot-bg); }
.cw-root .cw-msg--pending { opacity: 1; }
.cw-root .cw-msg-meta { display: block; margin: 5px 2px 0; color: var(--cw-muted); font-size: 12px; }
.cw-root .cw-msg--in .cw-msg-meta { text-align: right; }
.cw-root .cw-msg--failed .cw-msg-text { border-color: var(--cw-danger); }
.cw-root .cw-msg--failed .cw-msg-meta { color: var(--cw-danger); }
.cw-root .cw-retry { min-height: 44px; border-color: var(--cw-danger); color: var(--cw-danger); }

.cw-root .cw-contact { max-height: none; overflow: visible; margin: 15px 0 0; padding: 14px; background: var(--cw-paper); }
.cw-root .cw-contact-title { font-size: 17px; line-height: 1.25; }
.cw-root .cw-contact-note { margin: 5px 0 10px; color: var(--cw-muted); font-size: 14px; }
.cw-root .cw-button { min-height: 44px; border-radius: 11px; font-size: 14px; font-weight: 600; }
.cw-root .cw-button--primary:not(:disabled):hover, .cw-root .cw-send:hover { background: var(--cw-hover); filter: none; }
.cw-root .cw-input { min-height: 44px; border-radius: 10px; font-size: 16px; }
.cw-root .cw-status { padding: 6px 13px; background: var(--cw-paper); overflow-wrap: anywhere; }
.cw-root .cw-composer { padding: 11px 13px; background: var(--cw-paper); }
.cw-root .cw-composer .cw-input { height: 46px; padding: 11px; line-height: 22px; }
.cw-root .cw-send { width: 46px; height: 46px; border-radius: 10px; }

@media (max-width: 650px) {
    html.cw-support-locked, html.cw-support-locked body { overflow: hidden; overscroll-behavior: none; }
    .cw-root .cw-launcher {
        right: max(15px, env(safe-area-inset-right));
        bottom: max(15px, env(safe-area-inset-bottom));
        width: 52px;
        height: 52px;
        padding: 0;
    }
    .cw-root .cw-launcher-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
    .cw-root .cw-badge { position: absolute; }
    .cw-root .cw-panel { inset: 0; width: 100%; height: 100vh; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
    .cw-root .cw-header {
        min-height: 62px;
        padding: max(7px, env(safe-area-inset-top)) max(7px, env(safe-area-inset-right)) 7px max(12px, env(safe-area-inset-left));
    }
    .cw-root .cw-thread { padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left)); }
    .cw-root .cw-composer {
        padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
        padding-bottom: max(9px, env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: no-preference) {
    .cw-root .cw-panel:not([hidden]) { animation: cw-support-in 240ms cubic-bezier(.2,.72,.25,1) both; }
    .cw-root .cw-msg--new { animation: cw-support-in 210ms cubic-bezier(.2,.72,.25,1) both; }
    .cw-root .cw-badge:not([hidden]) { animation: cw-support-badge-in 250ms ease-out both; }
}
@keyframes cw-support-in {
    from { opacity: .55; transform: translateY(11px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes cw-support-badge-in {
    from { opacity: .5; transform: scale(.73); }
    to { opacity: 1; transform: scale(1); }
}
