:root {
    --towa-ai-primary: #2563eb;
    --towa-ai-violet: #7c3aed;
    --towa-ai-cyan: #06b6d4;
    --towa-ai-emerald: #10b981;
    --towa-ai-dark: #0f172a;
    --towa-ai-slate: #475569;
    --towa-ai-border: rgba(255, 255, 255, .18);
    --towa-ai-shadow: 0 28px 90px rgba(15, 23, 42, .28);
}

.towa-ai-chat {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 1080;
    font-family: inherit;
    opacity: 0;
    transform: translateY(26px) scale(.96);
    pointer-events: none;
    transition: opacity .65s ease, transform .65s cubic-bezier(.2,.9,.2,1);
}

.towa-ai-chat.is-visible-on-bottom {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.towa-ai-chat *,
.towa-ai-chat *::before,
.towa-ai-chat *::after {
    box-sizing: border-box;
}

.towa-ai-chat__launcher {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 178px;
    min-height: 66px;
    padding: 12px 18px 12px 12px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    color: #fff;
    background:
        radial-gradient(circle at 18% 18%, rgba(255,255,255,.35), transparent 26%),
        linear-gradient(135deg, #172554 0%, #2563eb 48%, #7c3aed 100%);
    box-shadow:
        0 18px 45px rgba(37, 99, 235, .35),
        inset 0 1px 0 rgba(255,255,255,.28);
    backdrop-filter: blur(18px);
    cursor: pointer;
    overflow: hidden;
    transition: transform .28s ease, box-shadow .28s ease, opacity .28s ease;
}

.towa-ai-chat__launcher:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 24px 64px rgba(37, 99, 235, .45),
        inset 0 1px 0 rgba(255,255,255,.36);
}

.towa-ai-chat__launcher.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(18px) scale(.94);
}

.towa-ai-chat__launcher-glow {
    position: absolute;
    inset: -35%;
    z-index: -1;
    background: conic-gradient(from 90deg, #06b6d4, #7c3aed, #10b981, #2563eb, #06b6d4);
    opacity: .42;
    filter: blur(14px);
    animation: towa-ai-spin 8s linear infinite;
}

.towa-ai-chat__launcher-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    border-radius: 16px;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.26);
}

.towa-ai-chat__launcher-icon i {
    font-size: 1.25rem;
}

.towa-ai-chat__launcher-text {
    display: grid;
    gap: 2px;
    text-align: left;
    line-height: 1.1;
}

.towa-ai-chat__launcher-text strong,
.towa-ai-chat__launcher-text small {
    color: #fff;
}

.towa-ai-chat__launcher-text strong {
    font-size: .98rem;
    font-weight: 900;
    letter-spacing: .02em;
}

.towa-ai-chat__launcher-text small {
    font-size: .76rem;
    opacity: .82;
}

.towa-ai-chat__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(420px, calc(100vw - 32px));
    height: min(680px, calc(100vh - 42px));
    display: grid;
    grid-template-rows: auto auto 1fr auto auto auto;
    border: 1px solid var(--towa-ai-border);
    border-radius: 32px;
    color: #fff;
    background:
        radial-gradient(circle at 12% 10%, rgba(6, 182, 212, .22), transparent 28%),
        radial-gradient(circle at 88% 0%, rgba(124, 58, 237, .28), transparent 30%),
        linear-gradient(180deg, rgba(15, 23, 42, .94), rgba(17, 24, 39, .92));
    box-shadow: var(--towa-ai-shadow);
    backdrop-filter: blur(24px);
    overflow: hidden;
    transform-origin: right bottom;
    animation: towa-ai-panel-in .32s cubic-bezier(.2,.9,.2,1);
}

.towa-ai-chat__panel[hidden] {
    display: none;
}

.towa-ai-chat__aurora {
    position: absolute;
    inset: -40%;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 20%, rgba(16, 185, 129, .22), transparent 24%),
        radial-gradient(circle at 70% 30%, rgba(37, 99, 235, .24), transparent 26%),
        radial-gradient(circle at 48% 74%, rgba(124, 58, 237, .20), transparent 28%);
    filter: blur(18px);
    opacity: .9;
    animation: towa-ai-float 10s ease-in-out infinite alternate;
}

.towa-ai-chat__header,
.towa-ai-chat__status,
.towa-ai-chat__messages,
.towa-ai-chat__chips,
.towa-ai-chat__form,
.towa-ai-chat__footer {
    position: relative;
    z-index: 1;
}

.towa-ai-chat__header {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 20px 20px 14px;
    border-bottom: 1px solid rgba(255,255,255,.10);
}

.towa-ai-chat__avatar {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 48px;
    border-radius: 18px;
    color: #fff;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,.32), transparent 30%),
        linear-gradient(135deg, var(--towa-ai-primary), var(--towa-ai-violet));
    box-shadow: 0 12px 30px rgba(37,99,235,.35);
}

.towa-ai-chat__avatar i {
    font-size: 1.35rem;
}

.towa-ai-chat__title {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.towa-ai-chat__title span {
    color: rgba(255,255,255,.66);
    font-size: .74rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.towa-ai-chat__title strong {
    color: #fff;
    font-size: 1.02rem;
    font-weight: 900;
    letter-spacing: -.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.towa-ai-chat__close {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 14px;
    color: #fff;
    background: rgba(255,255,255,.08);
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.towa-ai-chat__close:hover {
    background: rgba(255,255,255,.15);
    transform: rotate(90deg);
}

.towa-ai-chat__status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin: 14px 20px 8px;
    padding: 9px 12px;
    width: fit-content;
    border: 1px solid rgba(16,185,129,.22);
    border-radius: 999px;
    color: rgba(255,255,255,.82);
    background: rgba(16,185,129,.10);
    font-size: .78rem;
    font-weight: 800;
}

.towa-ai-chat__pulse {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #34d399;
    box-shadow: 0 0 0 0 rgba(52, 211, 153, .65);
    animation: towa-ai-pulse 1.7s ease-out infinite;
}

.towa-ai-chat__messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 20px 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.24) transparent;
}

.towa-ai-chat__message {
    display: flex;
}

.towa-ai-chat__message.is-user {
    justify-content: flex-end;
}

.towa-ai-chat__bubble {
    max-width: 86%;
    border-radius: 20px;
    padding: 13px 15px;
    font-size: .94rem;
    line-height: 1.72;
    word-break: break-word;
}

.towa-ai-chat__message.is-bot .towa-ai-chat__bubble {
    color: rgba(255,255,255,.92);
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.12);
    border-bottom-left-radius: 8px;
}

.towa-ai-chat__message.is-bot .towa-ai-chat__bubble strong {
    color: #fff;
}

.towa-ai-chat__message.is-user .towa-ai-chat__bubble {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-bottom-right-radius: 8px;
    box-shadow: 0 12px 28px rgba(37,99,235,.26);
}

.towa-ai-chat__typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

.towa-ai-chat__typing span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,.72);
    animation: towa-ai-dot 1s ease-in-out infinite;
}

.towa-ai-chat__typing span:nth-child(2) {
    animation-delay: .12s;
}

.towa-ai-chat__typing span:nth-child(3) {
    animation-delay: .24s;
}

.towa-ai-chat__chips {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 0 20px 14px;
    scrollbar-width: none;
}

.towa-ai-chat__chips::-webkit-scrollbar {
    display: none;
}

.towa-ai-chat__chips button {
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 999px;
    padding: 9px 12px;
    color: rgba(255,255,255,.88);
    background: rgba(255,255,255,.08);
    font-size: .82rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.towa-ai-chat__chips button:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.26);
}

.towa-ai-chat__form {
    display: grid;
    grid-template-columns: 1fr 46px;
    gap: 10px;
    padding: 14px 20px 16px;
    border-top: 1px solid rgba(255,255,255,.10);
}

.towa-ai-chat__form textarea {
    width: 100%;
    max-height: 110px;
    min-height: 46px;
    resize: none;
    outline: none;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 18px;
    padding: 12px 14px;
    color: #fff;
    background: rgba(255,255,255,.09);
    line-height: 1.55;
}

.towa-ai-chat__form textarea::placeholder {
    color: rgba(255,255,255,.46);
}

.towa-ai-chat__form textarea:focus {
    border-color: rgba(6,182,212,.55);
    box-shadow: 0 0 0 4px rgba(6,182,212,.11);
}

.towa-ai-chat__form button {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 18px;
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 14px 30px rgba(37,99,235,.3);
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.towa-ai-chat__form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(37,99,235,.38);
}

.towa-ai-chat__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 20px 20px;
}

.towa-ai-chat__footer a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
    font-size: .84rem;
    font-weight: 900;
    background: rgba(16,185,129,.20);
    border: 1px solid rgba(16,185,129,.28);
    transition: transform .2s ease, background .2s ease;
}

.towa-ai-chat__footer a:hover {
    color: #fff;
    transform: translateY(-2px);
    background: rgba(16,185,129,.28);
}

.towa-ai-chat__footer span {
    color: rgba(255,255,255,.54);
    font-size: .72rem;
    line-height: 1.45;
    text-align: right;
}

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

@keyframes towa-ai-panel-in {
    from {
        opacity: 0;
        transform: translateY(18px) scale(.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes towa-ai-float {
    from { transform: translate3d(-2%, -1%, 0) rotate(0deg); }
    to { transform: translate3d(2%, 1%, 0) rotate(8deg); }
}

@keyframes towa-ai-pulse {
    0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .65); }
    70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

@keyframes towa-ai-dot {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: .45;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@media (max-width: 767.98px) {
    .towa-ai-chat {
        right: 14px;
        bottom: 14px;
    }

    .towa-ai-chat__launcher {
        min-width: 62px;
        width: 62px;
        height: 62px;
        padding: 9px;
        justify-content: center;
    }

    .towa-ai-chat__launcher-text {
        display: none;
    }

    .towa-ai-chat__panel {
        position: fixed;
        inset: auto 10px 10px 10px;
        width: auto;
        height: min(680px, calc(100vh - 20px));
        border-radius: 28px;
    }

    .towa-ai-chat__footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .towa-ai-chat__footer span {
        text-align: left;
    }
}

/* Light theme update: softer AI chat window */
.towa-ai-chat__launcher {
    color: #0f172a;
    border: 1px solid rgba(37, 99, 235, .16);
    background:
        radial-gradient(circle at 20% 18%, rgba(255,255,255,.92), transparent 30%),
        linear-gradient(135deg, #ffffff 0%, #eef6ff 48%, #f5f3ff 100%);
    box-shadow:
        0 18px 45px rgba(37, 99, 235, .18),
        inset 0 1px 0 rgba(255,255,255,.92);
}

.towa-ai-chat__launcher:hover {
    box-shadow:
        0 24px 64px rgba(37, 99, 235, .24),
        inset 0 1px 0 rgba(255,255,255,.96);
}

.towa-ai-chat__launcher-icon {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.towa-ai-chat__launcher-text strong {
    color: #0f172a;
}

.towa-ai-chat__launcher-text small {
    color: #64748b;
    opacity: 1;
}

.towa-ai-chat__panel {
    color: #0f172a;
    border: 1px solid rgba(37, 99, 235, .14);
    background:
        radial-gradient(circle at 12% 8%, rgba(219, 234, 254, .95), transparent 34%),
        radial-gradient(circle at 92% 0%, rgba(237, 233, 254, .9), transparent 34%),
        linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
    box-shadow:
        0 28px 90px rgba(15, 23, 42, .18),
        inset 0 1px 0 rgba(255,255,255,.92);
}

.towa-ai-chat__aurora {
    background:
        radial-gradient(circle at 20% 20%, rgba(125, 211, 252, .30), transparent 26%),
        radial-gradient(circle at 70% 30%, rgba(196, 181, 253, .24), transparent 28%),
        radial-gradient(circle at 48% 74%, rgba(167, 243, 208, .28), transparent 30%);
    opacity: .7;
}

.towa-ai-chat__header {
    border-bottom: 1px solid rgba(37, 99, 235, .10);
}

.towa-ai-chat__title span {
    color: #2563eb;
}

.towa-ai-chat__title strong {
    color: #0f172a;
}

.towa-ai-chat__close {
    color: #334155;
    border: 1px solid rgba(37, 99, 235, .12);
    background: rgba(255,255,255,.72);
}

.towa-ai-chat__close:hover {
    background: rgba(219, 234, 254, .92);
}

.towa-ai-chat__status {
    color: #0f766e;
    border: 1px solid rgba(16,185,129,.20);
    background: rgba(236, 253, 245, .92);
}

.towa-ai-chat__message.is-bot .towa-ai-chat__bubble {
    color: #334155;
    background: rgba(255,255,255,.88);
    border: 1px solid rgba(148, 163, 184, .24);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .07);
}

.towa-ai-chat__message.is-bot .towa-ai-chat__bubble strong {
    color: #0f172a;
}

.towa-ai-chat__message.is-user .towa-ai-chat__bubble {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 12px 28px rgba(37,99,235,.22);
}

.towa-ai-chat__typing span {
    background: rgba(37, 99, 235, .72);
}

.towa-ai-chat__chips button {
    color: #334155;
    border: 1px solid rgba(37, 99, 235, .14);
    background: rgba(255,255,255,.88);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .05);
}

.towa-ai-chat__chips button:hover {
    color: #2563eb;
    background: rgba(239, 246, 255, .98);
    border-color: rgba(37, 99, 235, .26);
}

.towa-ai-chat__form {
    border-top: 1px solid rgba(37, 99, 235, .10);
}

.towa-ai-chat__form textarea {
    color: #0f172a;
    border: 1px solid rgba(148, 163, 184, .32);
    background: rgba(255,255,255,.94);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

.towa-ai-chat__form textarea::placeholder {
    color: #94a3b8;
}

.towa-ai-chat__form textarea:focus {
    border-color: rgba(37,99,235,.46);
    box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}

.towa-ai-chat__footer a {
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #10b981);
    border: 1px solid rgba(16,185,129,.18);
    box-shadow: 0 12px 26px rgba(15, 118, 110, .18);
}

.towa-ai-chat__footer a:hover {
    color: #fff;
    background: linear-gradient(135deg, #115e59, #059669);
}

.towa-ai-chat__footer span {
    color: #64748b;
}

.towa-ai-chat__footer {
    border-top: 0;
}

/* Smooth switch update: chat panel fades into the AI相談 button more gently */
.towa-ai-chat__launcher {
    transition:
        opacity .58s ease,
        transform .58s cubic-bezier(.2,.9,.2,1),
        box-shadow .35s ease,
        background .35s ease !important;
}

.towa-ai-chat__launcher.is-hidden {
    transition:
        opacity .42s ease,
        transform .42s cubic-bezier(.2,.9,.2,1) !important;
}

.towa-ai-chat__panel {
    transition:
        opacity .46s ease,
        transform .46s cubic-bezier(.2,.9,.2,1) !important;
}

.towa-ai-chat__panel.is-closing {
    opacity: 0;
    transform: translateY(18px) scale(.96);
    pointer-events: none;
}

/* Mobile viewport fix: make AI chat usable on narrow screens */
@media (max-width: 767.98px) {
    .towa-ai-chat {
        right: 12px !important;
        bottom: 12px !important;
        left: auto !important;
        width: auto !important;
        max-width: none !important;
    }

    .towa-ai-chat__launcher {
        min-width: 58px !important;
        width: 58px !important;
        height: 58px !important;
        min-height: 58px !important;
        padding: 8px !important;
        border-radius: 20px !important;
    }

    .towa-ai-chat__launcher-icon {
        width: 42px !important;
        height: 42px !important;
        flex-basis: 42px !important;
        border-radius: 16px !important;
    }

    .towa-ai-chat__panel {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: 12px !important;
        top: auto !important;
        width: auto !important;
        max-width: none !important;
        height: min(620px, calc(100dvh - 24px)) !important;
        max-height: calc(100dvh - 24px) !important;
        border-radius: 26px !important;
        transform-origin: right bottom !important;
    }

    .towa-ai-chat__header {
        padding: 16px 16px 12px !important;
        gap: 10px !important;
    }

    .towa-ai-chat__avatar {
        width: 42px !important;
        height: 42px !important;
        flex-basis: 42px !important;
        border-radius: 16px !important;
    }

    .towa-ai-chat__title span {
        font-size: .68rem !important;
    }

    .towa-ai-chat__title strong {
        font-size: .92rem !important;
        white-space: normal !important;
        line-height: 1.25 !important;
    }

    .towa-ai-chat__close {
        width: 36px !important;
        height: 36px !important;
        flex-basis: 36px !important;
        border-radius: 14px !important;
    }

    .towa-ai-chat__status {
        margin: 10px 16px 6px !important;
        padding: 8px 11px !important;
        font-size: .74rem !important;
    }

    .towa-ai-chat__messages {
        padding: 8px 16px 12px !important;
        gap: 10px !important;
    }

    .towa-ai-chat__bubble {
        max-width: 90% !important;
        padding: 12px 14px !important;
        font-size: .88rem !important;
        line-height: 1.62 !important;
    }

    .towa-ai-chat__chips {
        padding: 0 16px 12px !important;
        gap: 7px !important;
    }

    .towa-ai-chat__chips button {
        padding: 8px 11px !important;
        font-size: .78rem !important;
    }

    .towa-ai-chat__form {
        grid-template-columns: 1fr 44px !important;
        gap: 8px !important;
        padding: 12px 16px 12px !important;
    }

    .towa-ai-chat__form textarea {
        min-height: 44px !important;
        max-height: 86px !important;
        border-radius: 16px !important;
        padding: 11px 12px !important;
        font-size: 16px !important;
    }

    .towa-ai-chat__form button {
        width: 44px !important;
        height: 44px !important;
        border-radius: 16px !important;
    }

    .towa-ai-chat__footer {
        padding: 0 16px 16px !important;
        gap: 8px !important;
    }

    .towa-ai-chat__footer a {
        padding: 9px 13px !important;
        font-size: .8rem !important;
    }

    .towa-ai-chat__footer span {
        font-size: .68rem !important;
    }
}

/* Extra-small phones */
@media (max-width: 420px) {
    .towa-ai-chat__panel {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        height: min(600px, calc(100dvh - 16px)) !important;
        max-height: calc(100dvh - 16px) !important;
        border-radius: 24px !important;
    }

    .towa-ai-chat__footer {
        align-items: stretch !important;
    }

    .towa-ai-chat__footer a {
        justify-content: center !important;
        width: 100% !important;
    }
}

/* Mobile viewport fix v2:
   The parent .towa-ai-chat has transform for fade animation.
   On mobile, transform makes child position:fixed behave relative to the parent,
   so the chat panel can appear as a thin slice on the right.
   This override removes the mobile transform and makes launcher/panel fixed to viewport.
*/
@media (max-width: 767.98px) {
    .towa-ai-chat,
    .towa-ai-chat.is-visible-on-bottom {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100dvw !important;
        height: 0 !important;
        max-width: none !important;
        transform: none !important;
    }

    .towa-ai-chat {
        opacity: 0 !important;
        pointer-events: none !important;
        transition: opacity .55s ease !important;
    }

    .towa-ai-chat.is-visible-on-bottom {
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    .towa-ai-chat__launcher {
        position: fixed !important;
        right: 12px !important;
        bottom: 12px !important;
        left: auto !important;
        top: auto !important;
        z-index: 1090 !important;
        transform-origin: right bottom !important;
    }

    .towa-ai-chat__launcher.is-hidden {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translateY(12px) scale(.92) !important;
    }

    .towa-ai-chat__panel {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        top: auto !important;
        width: calc(100dvw - 20px) !important;
        max-width: calc(100dvw - 20px) !important;
        height: min(620px, calc(100dvh - 20px)) !important;
        max-height: calc(100dvh - 20px) !important;
        border-radius: 26px !important;
        z-index: 1091 !important;
        transform-origin: right bottom !important;
    }

    .towa-ai-chat__panel.is-closing {
        opacity: 0 !important;
        transform: translateY(18px) scale(.96) !important;
        pointer-events: none !important;
    }
}

@media (max-width: 420px) {
    .towa-ai-chat__panel {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        width: calc(100dvw - 16px) !important;
        max-width: calc(100dvw - 16px) !important;
        height: min(600px, calc(100dvh - 16px)) !important;
        max-height: calc(100dvh - 16px) !important;
        border-radius: 24px !important;
    }

    .towa-ai-chat__launcher {
        right: 10px !important;
        bottom: 10px !important;
    }
}
.towa-ai-chat__panel {
    position: relative;
    overflow: visible;
}

.towa-ai-chat__assistant-portrait {
    position: absolute;
    top: -34px;
    right: -8px;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    padding: 5px;
    background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(219,234,254,.9));
    box-shadow: 0 18px 42px rgba(15, 23, 42, .22);
    z-index: 10;
}

    .towa-ai-chat__assistant-portrait img {
        width: 100%;
        height: 100%;
        display: block;
        border-radius: 50%;
        object-fit: cover;
    }

.towa-ai-chat__header {
    padding-right: 112px;
}

@media (max-width: 575.98px) {
    .towa-ai-chat__assistant-portrait {
        top: -24px;
        right: 4px;
        width: 78px;
        height: 78px;
    }

    .towa-ai-chat__header {
        padding-right: 88px;
    }
}
