:root {
    --header-bg: #eaf3ff;
    --header-text: #202123;
    --bg-blue-light: #eaf3ff;
    --accent-color: #111111;
    --text-primary: #202123;
    --text-secondary: #8e8ea0;
    --bot-msg-bg: transparent;
    --bot-msg-text: #202123;
    --bot-msg-shadow: none;
    --user-msg-bg: #edf5ff;
    --user-msg-text: #202123;
    --surface-primary: #ffffff;
    --surface-secondary: #eaf3ff;
    --surface-tertiary: #d9e9ff;
    --surface-input: #ffffff;
    --surface-border: rgba(59, 130, 246, 0.14);
    --shell-surface: var(--surface-secondary);
    --shell-divider: rgba(59, 130, 246, 0.14);
    --link-color: #2563eb;

    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Noto Sans JP', sans-serif;
    --font-display: 'Montserrat', 'Noto Sans JP', sans-serif;

    --border-radius-lg: 20px;
    --border-radius-md: 16px;
    --border-radius-sm: 12px;
    --app-height: 100dvh;
    --footer-surface: #eaf3ff;
    --content-gutter: 22px;
    --sp-shell-header-height: 74px;
    --sp-shell-footer-height: 252px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    background: var(--surface-primary);
}

body {
    font-family: var(--font-body);
    margin: 0;
    color: var(--text-primary);
    overflow: hidden;
    background: var(--shell-surface);
}

button,
a,
input,
textarea {
    touch-action: manipulation;
}

/* ===== Floating Action Button (FAB) ===== */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #111111;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.22);
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fabPulse 3s infinite;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 28px rgba(26, 42, 108, 0.5);
}

.chat-fab:active {
    transform: scale(0.95);
}

.chat-fab.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

@keyframes fabPulse {
    0% {
        box-shadow: 0 6px 20px rgba(26, 42, 108, 0.4);
    }

    50% {
        box-shadow: 0 6px 20px rgba(26, 42, 108, 0.2), 0 0 0 8px rgba(26, 42, 108, 0.1);
    }

    100% {
        box-shadow: 0 6px 20px rgba(26, 42, 108, 0.4);
    }
}

/* ===== Close Button ===== */
.close-chat-btn {
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 1.6rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    opacity: 0.7;
    line-height: 1;
}

.close-chat-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
}

/* ===== Chat Container (Widget Mode) ===== */
.chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 100%;
    max-width: 420px;
    height: 680px;
    max-height: calc(100vh - 48px);
    background: var(--shell-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: var(--border-radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    z-index: 10000;
    /* Open/Close animation */
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.2s ease;
}

.chat-header,
.chat-footer-shell,
.quick-actions-container,
.input-area,
.chat-disclaimer {
    background: var(--shell-surface);
}

html[data-embedded='1'] .chat-container {
    position: relative;
    inset: 0;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: none;
    height: var(--app-height);
    max-height: var(--app-height);
    min-height: 320px;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: var(--surface-secondary);
}

html[data-mobile-direct='1'] .chat-container {
    position: relative;
    inset: 0;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: none;
    height: var(--app-height);
    max-height: none;
    min-height: var(--app-height);
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: var(--surface-secondary);
}

html[data-mobile-direct='1'] .chat-header {
    color: var(--header-text);
}

html[data-mobile-direct='1'] .chat-header .header-info h1 {
    color: var(--header-text);
}

html[data-mobile-direct='1'] .header-meta-row {
    gap: 8px;
}

html[data-mobile-direct='1'] .brand-badge {
    margin-left: 0;
}

html[data-mobile-direct='1'] .quick-actions-container {
    padding: 10px 16px 12px;
    border-top: none;
    border-bottom: 1px solid var(--shell-divider);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

html[data-mobile-direct='1'] .input-area {
    padding: 12px 16px 8px;
    gap: 10px;
    border-top: 1px solid var(--shell-divider);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

html[data-mobile-direct='1'] .chat-disclaimer {
    padding: 0 18px calc(12px + env(safe-area-inset-bottom, 0px));
    color: rgba(110, 110, 119, 0.9);
    font-size: 0.62rem;
    line-height: 1.45;
}

html[data-mobile-direct='1'] #user-input {
    min-height: 40px;
    padding: 8px 18px;
    box-shadow: none;
}

.chat-container.closed {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

html[data-embedded='1'] .chat-container.closed {
    transform: none;
    opacity: 1;
    pointer-events: auto;
}

html[data-embedded='1'][data-embed-mode='full'] .chat-fab,
html[data-embedded='1'][data-embed-mode='full'] .close-chat-btn {
    display: none;
}

html[data-embedded='1'][data-embed-mode='widget'] body {
    background: transparent;
}

html[data-embedded='1'][data-embed-mode='widget'] .chat-container {
    position: absolute;
    inset: 0;
    right: auto;
    bottom: auto;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    min-height: 0;
    border-radius: inherit;
    border: none;
    box-shadow: none;
    background: var(--shell-surface);
}

html[data-embedded='1'][data-embed-mode='widget'] .chat-fab {
    display: none;
}

html[data-embedded='1'][data-embed-mode='widget'] .chat-container.closed {
    transform: scale(0.96) translateY(8px);
    opacity: 0;
    pointer-events: none;
}

/* Mobile: full screen */
@media (max-width: 480px) {
    .chat-container {
        inset: 0;
        width: 100vw;
        max-width: 100vw;
        height: var(--app-height);
        max-height: var(--app-height);
        min-height: var(--app-height);
        border-radius: 0;
        border: none;
    }

    .chat-fab {
        bottom: 16px;
        right: 16px;
    }
}

/* Header */
.chat-header {
    background: var(--header-bg);
    padding: 16px 24px 14px;
    border-bottom: 1px solid var(--shell-divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
    color: var(--header-text);
    flex-shrink: 0;
}

.chat-footer-shell {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.header-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.header-info h1 {
    font-family: var(--font-heading);
    font-size: 1.18rem;
    color: var(--header-text);
    margin: 0;
    font-weight: 600;
    letter-spacing: 0;
}

.header-title-row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    flex-wrap: nowrap;
}

.header-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    min-width: 0;
    flex-wrap: wrap;
}

.status-badge {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: #4cd137;
    font-weight: 500;
}

.header-meta-separator {
    width: 1px;
    height: 14px;
    background: rgba(113, 113, 122, 0.35);
    flex-shrink: 0;
}

.multilingual-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: rgba(39, 39, 42, 0.86);
    font-weight: 500;
    white-space: nowrap;
}

.multilingual-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.76rem;
    line-height: 1;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    color: rgba(82, 82, 91, 0.82);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.surface-role-badge {
    --surface-role-badge-color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    height: 28px;
    padding: 0 14px;
    border: 1px solid var(--surface-role-badge-color);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.64);
    color: var(--surface-role-badge-color);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}

.surface-role-badge[hidden] {
    display: none;
}

.surface-role-badge[data-tone='guide'] {
    --surface-role-badge-color: #007c80;
}

.surface-role-badge[data-tone='concierge'] {
    --surface-role-badge-color: #9a641a;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #4cd137;
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 8px rgba(76, 209, 55, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(76, 209, 55, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(76, 209, 55, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(76, 209, 55, 0);
    }
}

/* Chat Log */
.chat-log {
    flex: 1;
    min-height: 0;
    padding: 22px var(--content-gutter) 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
    background: var(--surface-primary);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(15, 23, 42, 0.12) transparent;
}

.content-rail {
    width: 100%;
}

html.keyboard-open .chat-log {
    justify-content: flex-start;
}

html.keyboard-open[data-compact-layout='1'] .chat-header {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}

html.keyboard-open[data-compact-layout='1'][data-embedded='1'][data-embed-mode='widget'] .chat-log,
html.keyboard-open[data-compact-layout='1'][data-mobile-direct='1'] .chat-log {
    top: 0;
    bottom: calc(var(--sp-shell-footer-height-current, 0px) - var(--sp-shell-header-height));
}

.chat-log::-webkit-scrollbar {
    width: 6px;
}

.chat-log::-webkit-scrollbar-thumb {
    background-color: rgba(15, 23, 42, 0.12);
    border-radius: 3px;
}

.message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    animation: slideUpFade 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    padding: 14px 18px;
    border-radius: var(--border-radius-md);
    line-height: 1.6;
    font-size: 0.95rem;
    position: relative;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: normal;
    box-shadow: none;
}

.message-content p {
    margin: 0;
}

.message-content ul {
    margin: 0;
    padding-left: 1.15em;
}

.message-content p + ul {
    margin-top: 0.35em;
}

.message-content li {
    margin: 0;
}

.message-content li + li {
    margin-top: 0.35em;
}

.chat-link {
    color: var(--accent-color);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
    transition: opacity 0.2s ease;
}

.chat-link:hover {
    opacity: 0.7;
}

.message-content.welcome {
    white-space: normal;
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 6px;
    font-weight: 400;
}

/* Bot Message */
.bot-message {
    align-self: flex-start;
    max-width: 100%;
    width: 100%;
    gap: 8px;
    padding: 0;
}

.bot-message .message-content {
    background: transparent;
    color: var(--bot-msg-text);
    border-radius: 0;
    box-shadow: none;
    border: none;
    padding: 0;
    width: 100%;
    max-width: 36rem;
    font-size: 1rem;
    line-height: 1.78;
    letter-spacing: 0.01em;
}

html[data-chat-variant='agentic'] .bot-message .message-content {
    max-width: min(48rem, 100%);
    font-size: 1.02rem;
    line-height: 1.86;
}

html[data-chat-variant='agentic'] .chat-log {
    background:
        radial-gradient(circle at top right, rgba(217, 232, 255, 0.7), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 252, 255, 0.98));
}

html[data-chat-variant='agentic'] .quick-actions-label {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bot-message .message-time {
    align-self: flex-start;
    margin-left: 0;
    margin-top: -4px;
    color: #8e8ea0;
}

.bot-message .message-content p + p,
.bot-message .message-content ul + p,
.bot-message .message-content p + ul {
    margin-top: 0.85em;
}

.bot-message .message-content p + .source-inline-image,
.bot-message .message-content ul + .source-inline-image,
.bot-message .message-content .source-inline-image + .source-inline-image {
    margin-top: 0.95em;
}

.bot-message .message-content strong {
    font-family: var(--font-display);
    font-weight: 700;
    color: #111827;
}

.source-inline-image {
    display: block;
    margin: 0;
    max-width: 100%;
}

.source-inline-image__button {
    display: block;
    width: 100%;
    max-width: min(100%, 520px);
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: transparent;
    cursor: zoom-in;
}

.source-inline-image__button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.36);
    outline-offset: 3px;
}

.source-inline-image img {
    display: block;
    width: 100%;
    max-height: min(62vh, 640px);
    object-fit: contain;
    object-position: top left;
    border: 1px solid rgba(140, 158, 185, 0.34);
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(31, 41, 55, 0.12);
}

.source-inline-image figcaption {
    margin-top: 0.35em;
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

.source-inline-image__hint {
    display: inline-flex;
    margin-left: 0.65em;
    color: var(--link-color);
    font-weight: 600;
}

html[data-mobile-direct='1'] .source-inline-image img {
    max-height: min(56vh, 520px);
}

.source-image-viewer {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: stretch;
    justify-content: center;
    padding: max(18px, env(safe-area-inset-top, 0px)) 18px max(18px, env(safe-area-inset-bottom, 0px));
}

.source-image-viewer.is-open {
    display: flex;
}

.source-image-viewer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 18, 31, 0.74);
}

.source-image-viewer__panel {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: 1fr auto;
    width: min(1180px, 100%);
    max-height: 100%;
    overflow: hidden;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.source-image-viewer__close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(17, 24, 39, 0.1);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #111827;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
}

.source-image-viewer__stage {
    overflow: auto;
    padding: 58px 18px 18px;
    -webkit-overflow-scrolling: touch;
    background:
        linear-gradient(45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(148, 163, 184, 0.08) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(148, 163, 184, 0.08) 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
}

.source-image-viewer__image {
    display: block;
    width: min(1120px, 92vw);
    max-width: none;
    height: auto;
    margin: 0 auto;
    border: 1px solid rgba(140, 158, 185, 0.4);
    border-radius: 12px;
    background: #ffffff;
}

.source-image-viewer__caption {
    padding: 10px 18px 14px;
    border-top: 1px solid rgba(140, 158, 185, 0.22);
    color: #4b5563;
    font-size: 0.86rem;
    line-height: 1.45;
}

.chat-link {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 0.14em;
}

.typing-content {
    display: inline-flex;
    align-items: center;
    gap: 0.1em;
}

.streaming-message .message-content {
    transition: opacity 0.15s ease;
}

.typing-dots {
    display: inline-flex;
}

.typing-dots span {
    display: inline-block;
    width: 0.45em;
    animation: typingBlink 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingBlink {
    0%, 80%, 100% {
        opacity: 0.2;
    }

    40% {
        opacity: 1;
    }
}

/* User Message */
.user-message {
    align-self: flex-end;
}

.user-message .message-content {
    background: var(--user-msg-bg);
    color: var(--user-msg-text);
    border-bottom-right-radius: 10px;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.04);
    font-weight: 500;
}

.user-message .message-time {
    align-self: flex-end;
    margin-right: 8px;
}

/* Quick Actions Area */
.quick-actions-container {
    padding: 10px var(--content-gutter) 14px;
    border-top: 1px solid var(--shell-divider);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex-shrink: 0;
}

.quick-actions-container .content-rail {
    display: flex;
    flex-direction: column;
}

.quick-actions-label {
    font-size: 0.8rem;
    color: #5f6368;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-grid-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(95, 99, 104, 0.8);
}

.toggle-grid-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #202123;
}

.toggle-grid-btn svg {
    transition: transform 0.3s ease;
}

.toggle-grid-btn.collapsed svg {
    transform: rotate(180deg);
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
}

.quick-actions-grid.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    gap: 0;
}

.action-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 12px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.12s ease-out;
    box-shadow: none;
    height: 44px;
}

.action-card:hover {
    background: #ffffff;
    box-shadow: none;
    border-color: rgba(0, 0, 0, 0.06);
}

.action-card:hover .action-text {
    color: #202123;
}

.action-card:active {
    transform: scale(0.98);
}

.action-text {
    font-size: 0.77rem;
    color: #343541;
    font-weight: 600;
    line-height: 1.15;
    font-family: var(--font-body);
    overflow-wrap: anywhere;
    word-break: break-word;
}



/* Input Area */
.input-area {
    padding: 12px var(--content-gutter) 8px;
    backdrop-filter: none;
    border-top: 1px solid var(--shell-divider);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-shrink: 0;
}

.input-rail {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    width: 100%;
}

.chat-disclaimer {
    margin: 0;
    padding: 0 var(--content-gutter) calc(12px + env(safe-area-inset-bottom, 0px));
    color: #8e8ea0;
    font-size: 0.64rem;
    line-height: 1.5;
    flex-shrink: 0;
}

html[data-embedded='1'][data-embed-mode='widget'][data-compact-layout='1'] .chat-container,
html[data-mobile-direct='1'][data-compact-layout='1'] .chat-container {
    position: relative;
    overflow: hidden;
}

html[data-embedded='1'][data-embed-mode='widget'][data-compact-layout='1'] .chat-header,
html[data-mobile-direct='1'][data-compact-layout='1'] .chat-header {
    position: absolute;
    inset: 0 0 auto 0;
    height: var(--sp-shell-header-height);
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    transition: none;
}

html[data-embedded='1'][data-embed-mode='widget'][data-compact-layout='1'] .chat-log,
html[data-mobile-direct='1'][data-compact-layout='1'] .chat-log {
    position: absolute;
    top: var(--sp-shell-header-height);
    right: 0;
    bottom: var(--sp-shell-footer-height-current, 0px);
    left: 0;
    padding-top: 18px;
    padding-bottom: 16px;
    border-top: none;
    border-bottom: none;
}

html[data-embedded='1'][data-embed-mode='widget'][data-compact-layout='1'] .chat-footer-shell,
html[data-mobile-direct='1'][data-compact-layout='1'] .chat-footer-shell {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--shell-divider);
}

#user-input {
    flex: 1;
    padding: 8px 18px;
    background: var(--surface-input);
    color: #202123;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    font-size: 0.95rem;
    outline: none;
    font-family: var(--font-body);
    line-height: 1.5;
    transition: all 0.3s ease;
    box-shadow: none;
    resize: none;
    min-height: 40px;
    max-height: calc(1.5em * 2 + 16px);
    overflow-y: hidden;
    overflow-x: hidden;
    display: block;
}

#user-input::placeholder {
    color: #8e8ea0;
}

#user-input:focus {
    background: var(--surface-input);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

#send-btn {
    background: #111111;
    color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    width: 48px;
    height: 48px;
    border-radius: 999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: none;
}

#send-btn:hover {
    transform: scale(1.03);
    box-shadow: none;
}

#send-btn:active {
    transform: scale(0.95);
}

#send-btn:disabled {
    background: #d1d5db;
    color: rgba(17, 24, 39, 0.55);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    margin-left: -2px;
    /* Visual adjustment */
    margin-top: 2px;
}

#send-btn[data-mode='stop'] {
    background: #ffffff;
    color: #111111;
    box-shadow: 0 0 0 1px rgba(17, 17, 17, 0.08);
}

#send-btn[data-mode='stop']:hover {
    transform: none;
}

.action-card:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    :root {
        --content-gutter: 16px;
        --sp-shell-header-height: calc(86px + env(safe-area-inset-top, 0px));
        --sp-shell-footer-height: calc(196px + env(safe-area-inset-bottom, 0px));
    }

    .chat-header {
        padding: calc(12px + env(safe-area-inset-top, 0px)) var(--content-gutter) 12px;
    }

    .header-info h1 {
        font-size: 1.1rem;
    }

    .header-title-row {
        gap: 4px;
    }

    .header-meta-row {
        gap: 8px;
        margin-top: 3px;
    }

    .status-badge,
    .multilingual-badge,
    .brand-badge,
    .surface-role-badge {
        font-size: 0.69rem;
    }

    .header-meta-separator {
        height: 12px;
    }

    .brand-badge {
        font-size: 0.66rem;
    }

    .surface-role-badge {
        min-width: 72px;
        height: 26px;
        padding: 0 12px;
    }

    .chat-log {
        padding: 18px var(--content-gutter) 14px;
        gap: 18px;
    }

    .message {
        max-width: 90%;
    }

    .message-content {
        padding: 12px 14px;
        font-size: 0.92rem;
        line-height: 1.55;
    }

    .source-inline-image img {
        max-height: min(54vh, 460px);
        border-radius: 14px;
    }

    .source-inline-image__button {
        border-radius: 14px;
    }

    .source-image-viewer {
        padding: 10px;
    }

    .source-image-viewer__panel {
        border-radius: 18px;
    }

    .source-image-viewer__stage {
        padding: 56px 12px 12px;
    }

    .source-image-viewer__image {
        width: 720px;
        margin: 0;
    }

    .quick-actions-label { margin-bottom: 8px; }

    .quick-actions-grid {
        gap: 8px;
        transition: none;
    }

    .toggle-grid-btn svg {
        transition: none;
    }

    .action-card {
        min-height: 40px;
        height: 40px;
        padding: 0 8px;
        border-radius: 12px;
    }

    .action-text {
        font-size: 0.74rem;
        line-height: 1.1;
    }

    #user-input {
        font-size: 16px;
    }

    html[data-mobile-direct='1'] .quick-actions-container {
        padding: 8px var(--content-gutter) 10px;
    }

    html[data-mobile-direct='1'] .input-area {
        padding: 12px var(--content-gutter) 8px;
    }

    html[data-mobile-direct='1'] .chat-disclaimer {
        padding: 0 var(--content-gutter) calc(12px + env(safe-area-inset-bottom, 0px));
        font-size: 0.62rem;
    }

    html[data-embedded='1'][data-embed-mode='widget'][data-compact-layout='1'] .chat-log,
    html[data-mobile-direct='1'][data-compact-layout='1'] .chat-log {
        gap: 16px;
    }
}
