.hzai-launcher {
    position: fixed;
    right: 17px;
    bottom: 82px;
    z-index: 999999;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.hzai-launcher > img {
    display: block;
    width: 58px;
    height: 58px;
    object-fit: contain;
    filter: drop-shadow(0 5px 7px #19346a2b);
    transform-origin: 50% 90%;
    animation: hzaiSlowShake 3.2s ease-in-out infinite;
}

.hzai-launcher:focus-visible {
    outline: 2px solid #315bff;
    outline-offset: 4px;
    border-radius: 12px;
}

@keyframes hzaiSlowShake {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-2px) rotate(2deg); }
}

.hzai-launcher.hidden { display: none; }

.hzai-panel {
    display: none;
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 999999;
    width: min(400px, calc(100vw - 28px));
    height: min(608px, calc(100vh - 28px));
    overflow: hidden;
    border: 1px solid #cfdcf2;
    border-radius: 24px;
    background: #f8fbff;
    box-shadow: 0 24px 70px #0a1e4738;
    color: #111a35;
    font-family: Inter, Arial, sans-serif;
}

.hzai-panel.open {
    display: flex;
    flex-direction: column;
    animation: hzaiPanelIn .22s ease-out;
}

@keyframes hzaiPanelIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.hzai-panel header {
    display: flex;
    flex: 0 0 68px;
    align-items: center;
    gap: 9px;
    padding: 0 16px;
    border-bottom: 1px solid #dfe7f3;
    background: #fff;
}

.hzai-head-avatar {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    overflow: hidden;
    border: 1px solid #dce8ff;
    border-radius: 50%;
    background: #edf3ff;
    color: #3564f1;
    font-size: 17px;
    font-weight: 700;
}

.hzai-panel header strong {
    display: block;
    color: #10182f;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.15;
}

.hzai-panel header small {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    color: #68758d;
    font-size: 12px;
}

.hzai-panel header small i {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #43cc73;
    box-shadow: 0 0 0 3px #e3f8e9;
}

.hzai-panel header button {
    display: grid;
    width: 42px;
    height: 42px;
    margin-left: auto;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #f3f6fb;
    color: #58667d;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
}

.hzai-welcome {
    position: relative;
    flex: 0 0 157px;
    overflow: hidden;
    padding: 23px 160px 18px 21px;
    border-bottom: 1px solid #dfe7f3;
    background: linear-gradient(110deg, #fbfdff 38%, #eef4ff 100%);
}

.hzai-welcome h2 {
    position: relative;
    z-index: 1;
    margin: 0 0 8px;
    color: #0d1733;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -.5px;
    line-height: 1.15;
}

.hzai-welcome h2 span {
    display: inline-block;
    margin-left: 4px;
    font-size: 20px;
    transform: rotate(-9deg);
}

.hzai-welcome p {
    position: relative;
    z-index: 1;
    margin: 0;
    color: #536583;
    font-size: 15px;
    line-height: 1.42;
}

.hzai-welcome > img {
    position: absolute;
    right: -7px;
    bottom: -25px;
    width: 165px;
    height: 165px;
    object-fit: contain;
}

.hzai-quick {
    display: grid;
    flex: 0 0 113px;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 15px 14px;
    border-bottom: 1px solid #e1e8f4;
    background: #fff;
}

.hzai-quick button {
    position: relative;
    display: grid;
    min-width: 0;
    grid-template-columns: 40px minmax(0, 1fr) 14px;
    grid-template-rows: auto auto;
    column-gap: 9px;
    align-content: center;
    padding: 10px 8px 10px 10px;
    border: 1px solid #d6e2f4;
    border-radius: 16px;
    background: #fff;
    color: #14203c;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.hzai-quick button:hover,
.hzai-quick button:focus-visible {
    border-color: #9db7ff;
    box-shadow: 0 8px 20px #315bff12;
    transform: translateY(-1px);
}

.hzai-quick-icon {
    display: grid;
    grid-row: 1 / 3;
    width: 40px;
    height: 40px;
    place-items: center;
    align-self: center;
    border: 1px solid #c9dbff;
    border-radius: 12px;
    background: #f5f8ff;
    color: #315bff;
    font-size: 18px;
}

.hzai-quick button span:not(.hzai-quick-icon) {
    overflow: hidden;
    align-self: end;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.05;
    text-overflow: ellipsis;
}

.hzai-quick button small {
    overflow: hidden;
    align-self: start;
    margin-top: 4px;
    color: #71809a;
    font-size: 10.5px;
    line-height: 1.2;
    text-overflow: ellipsis;
}

.hzai-quick button em {
    grid-column: 3;
    grid-row: 1 / 3;
    align-self: center;
    color: #83a1d2;
    font-size: 26px;
    font-style: normal;
    font-weight: 300;
}

.hzai-panel main {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 7px 14px 12px;
    background: linear-gradient(#fbfdff, #f7faff);
    scrollbar-color: #cdd9eb transparent;
    scrollbar-width: thin;
}

.hzai-msg {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 12px 0;
}

.hzai-msg-avatar {
    display: grid;
    flex: 0 0 29px;
    width: 29px;
    height: 29px;
    place-items: center;
    border-radius: 50%;
    background: #e7efff;
    color: #315bff;
    font-size: 9px;
    font-weight: 700;
}

.hzai-msg > .hzai-bubble {
    max-width: 80%;
    padding: 11px 13px;
    border: 1px solid #d9e2ef;
    border-radius: 17px 17px 17px 5px;
    background: #fff;
    color: #25334d;
    font-size: 13px;
    line-height: 1.48;
}

.hzai-msg.user { justify-content: flex-end; }
.hzai-msg.user .hzai-msg-avatar { order: 2; background: #e2f8e9; color: #218746; }
.hzai-msg.user > .hzai-bubble {
    order: 1;
    border: 0;
    border-radius: 17px 17px 5px 17px;
    background: linear-gradient(135deg, #315bff, #3766ef);
    color: #fff;
}

.hzai-msg strong { color: #172b51; font-weight: 600; }
.hzai-msg.user strong { color: #fff; }
.hzai-msg a { display: inline-block; margin-top: 7px; color: #315bff; font-weight: 600; text-decoration: none; }
.hzai-msg.user a { color: #fff; text-decoration: underline; }
.hzai-bullet { display: inline-block; margin: 0 7px 0 2px; color: #315bff; font-weight: 700; }
.hzai-msg.typing .dots { animation: hzaiDots 1s steps(4, end) infinite; }

@keyframes hzaiDots { to { opacity: .25; } }

.hzai-panel form {
    display: flex;
    flex: 0 0 82px;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #dfe7f3;
    background: #fff;
}

.hzai-field {
    display: flex;
    min-width: 0;
    height: 56px;
    flex: 1;
    align-items: center;
    border: 2px solid #315bff;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 0 0 3px #315bff12;
}

.hzai-input-icon {
    width: 44px;
    flex: 0 0 44px;
    color: #a2aec3;
    text-align: center;
    font-size: 17px;
}

.hzai-panel input {
    min-width: 0;
    height: 100%;
    flex: 1;
    padding: 0 12px 0 0;
    border: 0;
    outline: none;
    background: transparent;
    color: #1e3055;
    font: 13px Inter, Arial, sans-serif;
}

.hzai-panel input::placeholder { color: #8c9ab5; }

.hzai-panel form > button {
    display: grid;
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, #4086f4, #315bea);
    box-shadow: 0 8px 18px #315bff3d;
    color: #fff;
    font-size: 25px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .hzai-launcher { right: 7px; bottom: 65px; width: 54px; height: 54px; }
    .hzai-launcher > img { width: 54px; height: 54px; }
    .hzai-panel { right: 7px; bottom: 7px; width: calc(100vw - 14px); height: min(608px, calc(100dvh - 14px)); }
    .hzai-welcome { padding-right: 145px; }
    .hzai-welcome > img { right: -12px; width: 158px; height: 158px; }
}

@media (max-height: 620px) {
    .hzai-panel { bottom: 7px; height: calc(100dvh - 14px); }
    .hzai-welcome { flex-basis: 130px; padding-top: 17px; }
    .hzai-welcome > img { width: 142px; height: 142px; }
    .hzai-quick { flex-basis: 104px; padding-top: 11px; padding-bottom: 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .hzai-launcher > img { animation: none; }
    .hzai-panel.open { animation: none; }
}
