:root {
    --zpb-ai-bg: #ffffff;
    --zpb-ai-panel: #f4f5f7;
    --zpb-ai-card: #ffffff;
    --zpb-ai-text: #101828;
    --zpb-ai-muted: #8b95a5;
    --zpb-ai-border: #e4e7ee;
    --zpb-ai-soft: #f5f6f8;
    --zpb-ai-bubble: #f1f2f5;
    --zpb-ai-primary: #71b6a7;
    --zpb-ai-blue: #3f7eff;
    --zpb-ai-success: #7ee0a3;
    --zpb-ai-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

body.dark-theme,
body.theme-dark,
body.dark,
body.night,
html[data-theme="dark"],
body[data-theme="dark"],
body.zibll-dark {
    --zpb-ai-bg: #111318;
    --zpb-ai-panel: #171a20;
    --zpb-ai-card: #1d222b;
    --zpb-ai-text: #edf2f7;
    --zpb-ai-muted: #9aa4b2;
    --zpb-ai-border: #2b3038;
    --zpb-ai-soft: #171a20;
    --zpb-ai-bubble: #20252d;
    --zpb-ai-shadow: 0 10px 30px rgba(0, 0, 0, .24);
}

.zpb-ai-page {
    min-height: calc(100vh - 70px);
    background: var(--zpb-ai-bg);
    color: var(--zpb-ai-text);
}

.zpb-ai-layout {
    display: grid;
    grid-template-columns: 288px minmax(0, 1fr);
    min-height: calc(100vh - 70px);
}

.zpb-ai-sidebar {
    padding: 18px 12px;
    background: var(--zpb-ai-panel);
    border-right: 1px solid var(--zpb-ai-border);
}

.zpb-side-nav {
    display: grid;
    gap: 8px;
    padding: 0 8px 16px;
    border-bottom: 1px solid var(--zpb-ai-border);
}

.zpb-side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 36px;
    padding: 0 6px;
    border-radius: 8px;
    color: var(--zpb-ai-text);
    text-decoration: none;
    font-size: 15px;
    transition: color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.zpb-side-nav a:hover,
.zpb-side-nav a.active,
.zpb-side-nav a.is-active {
    background: var(--zpb-ai-card);
    color: var(--zpb-ai-blue);
    box-shadow: 0 8px 20px rgba(63, 126, 255, .08);
    transform: translateX(2px);
}

.zpb-side-nav span {
    width: 18px;
    text-align: center;
}

.zpb-side-nav b {
    margin-left: auto;
    font-size: 18px;
    font-weight: 400;
}

.zpb-side-history {
    padding: 18px 4px;
}

.zpb-history-tabs {
    display: flex;
    justify-content: space-around;
    margin-bottom: 16px;
    color: var(--zpb-ai-muted);
    font-size: 14px;
}

.zpb-history-tabs b {
    color: var(--zpb-ai-text);
}

.zpb-mini-app {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
    padding: 8px;
}

.zpb-red-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #ff3151;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.zpb-mini-app strong,
.zpb-history-card strong {
    display: block;
    overflow: hidden;
    color: var(--zpb-ai-text);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.zpb-mini-app small,
.zpb-history-card small {
    display: block;
    margin-top: 4px;
    overflow: hidden;
    color: var(--zpb-ai-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.zpb-history-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto auto auto;
    gap: 9px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--zpb-ai-border);
    border-radius: 14px;
    background: var(--zpb-ai-card);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.zpb-history-card:hover {
    border-color: rgba(63, 126, 255, .38);
    transform: translateY(-1px);
}

.zpb-history-card strong {
    color: var(--zpb-ai-blue);
}

.zpb-history-card i {
    color: var(--zpb-ai-muted);
    font-style: normal;
    font-size: 13px;
}

.zpb-gpt-icon,
.zpb-assistant-avatar,
.zpb-message-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--zpb-ai-primary);
    color: #fff;
}

.zpb-gpt-icon {
    width: 34px;
    height: 34px;
    font-size: 21px;
}

.zpb-ai-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: calc(100vh - 70px);
    padding: 24px 18px;
}

.zpb-ai-chat {
    width: min(900px, 100%);
    margin: 0 auto;
    flex: 1 1 auto;
}

.zpb-app-intro {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    width: min(660px, 100%);
    margin: 18px auto 30px;
    padding: 18px;
    border: 1px solid var(--zpb-ai-border);
    border-radius: 16px;
    background: var(--zpb-ai-card);
    box-shadow: var(--zpb-ai-shadow);
}

.zpb-app-intro:hover {
    border-color: rgba(63, 126, 255, .26);
}

.zpb-assistant-avatar,
.zpb-message-avatar {
    width: 42px;
    height: 42px;
    font-size: 25px;
}

.zpb-app-copy h1 {
    margin: 0 0 6px;
    color: var(--zpb-ai-text);
    font-size: 18px;
    line-height: 1.35;
    letter-spacing: 0;
}

.zpb-app-copy p {
    margin: 0;
    color: var(--zpb-ai-muted);
    font-size: 14px;
    line-height: 1.6;
}

.zpb-quick-prompts {
    width: min(660px, 100%);
    margin: 0 auto 28px;
}

.zpb-quick-prompts button {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 12px 0;
    padding: 13px 16px;
    border: 1px solid var(--zpb-ai-border);
    border-radius: 10px;
    background: var(--zpb-ai-soft);
    color: var(--zpb-ai-text);
    text-align: left;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color .2s ease, background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.zpb-quick-prompts button:hover,
.zpb-quick-prompts button.is-active {
    border-color: rgba(63, 126, 255, .5);
    color: var(--zpb-ai-blue);
    box-shadow: 0 8px 22px rgba(63, 126, 255, .1);
    transform: translateY(-1px);
}

.zpb-thread {
    width: min(860px, 100%);
    margin: 0 auto;
}

.zpb-user-bubble {
    width: min(450px, 100%);
    margin: 0 0 86px auto;
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--zpb-ai-bubble);
    color: var(--zpb-ai-text);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.75;
}

.zpb-ai-message {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin: 0 0 28px;
}

.zpb-message-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    color: var(--zpb-ai-text);
    font-weight: 700;
}

.zpb-thinking-badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(126, 224, 163, .22);
    color: #25a85f;
    font-size: 13px;
}

.zpb-thinking-dot {
    width: 14px;
    height: 14px;
    margin: 8px 0 0 18px;
    border-radius: 50%;
    background: var(--zpb-ai-text);
    animation: zpbPulse 1s infinite ease-in-out;
}

.zpb-result-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 16px;
    color: var(--zpb-ai-text);
    font-weight: 700;
}

.zpb-result-status::before {
    content: "✓";
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: var(--zpb-ai-success);
    color: #fff;
    font-size: 12px;
}

.zpb-result-image {
    display: block;
    max-width: min(500px, 100%);
    border-radius: 8px;
    box-shadow: var(--zpb-ai-shadow);
}

.zpb-result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
    color: var(--zpb-ai-muted);
    font-size: 12px;
}

.zpb-result-meta span {
    padding: 3px 8px;
    border: 1px solid var(--zpb-ai-border);
    border-radius: 999px;
    background: var(--zpb-ai-card);
}

.zpb-result-actions {
    display: flex;
    gap: 18px;
    margin: 18px 0 0;
    color: var(--zpb-ai-muted);
}

.zpb-result-actions a,
.zpb-result-actions button {
    border: 0;
    background: transparent;
    color: inherit;
    text-decoration: none;
    font-size: 15px;
}

.zpb-error {
    margin-top: 8px;
    color: #ef4444;
}

.zpb-ai-form {
    width: min(824px, 100%);
    margin: 22px auto 0;
    flex: 0 0 auto;
}

.zpb-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    overflow-x: auto;
    padding: 0 0 5px;
}

.zpb-toolbar button {
    flex: 0 0 auto;
    height: 34px;
    padding: 0 16px;
    border: 1px solid var(--zpb-ai-border);
    border-radius: 999px;
    background: var(--zpb-ai-card);
    color: var(--zpb-ai-text);
    font-weight: 700;
    white-space: nowrap;
    transition: border-color .2s ease, color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.zpb-toolbar button:disabled {
    color: var(--zpb-ai-muted);
}

.zpb-toolbar button:not(:disabled):hover,
.zpb-toolbar button.is-active {
    border-color: rgba(63, 126, 255, .5);
    color: var(--zpb-ai-blue);
    box-shadow: 0 8px 20px rgba(63, 126, 255, .08);
    transform: translateY(-1px);
}

.zpb-toolbar button.is-pulse,
.zpb-generate.is-pulse {
    animation: zpbButtonPulse .32s ease;
}

.zpb-round-btn {
    width: 36px;
    padding: 0 !important;
}

.zpb-composer {
    min-height: 140px;
    padding: 16px 16px 14px;
    border: 1px solid var(--zpb-ai-border);
    border-radius: 24px;
    background: var(--zpb-ai-soft);
    box-shadow: var(--zpb-ai-shadow);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.zpb-composer.is-focus {
    border-color: rgba(63, 126, 255, .55);
    box-shadow: 0 14px 36px rgba(63, 126, 255, .14);
}

.zpb-composer textarea {
    width: 100%;
    min-height: 70px;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    color: var(--zpb-ai-text);
    font-size: 15px;
    line-height: 1.6;
}

.zpb-composer textarea::placeholder {
    color: var(--zpb-ai-muted);
}

.zpb-composer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.zpb-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.zpb-controls select,
.zpb-workflow {
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--zpb-ai-border);
    border-radius: 999px;
    background: var(--zpb-ai-card);
    color: var(--zpb-ai-text);
    font-weight: 700;
}

.zpb-workflow:hover,
.zpb-controls select:hover {
    border-color: rgba(63, 126, 255, .42);
}

.zpb-generate {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #dfe7f5;
    color: #fff;
}

.zpb-generate:not(:disabled) {
    background: #b7c9ff;
}

.zpb-generate:not(:disabled):hover {
    background: var(--zpb-ai-blue);
    transform: translateY(-1px);
}

.zpb-generate span {
    font-size: 21px;
    line-height: 1;
}

@keyframes zpbPulse {
    0%,
    100% {
        transform: scale(.65);
        opacity: .55;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zpbButtonPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(.94);
    }
    100% {
        transform: scale(1);
    }
}

@media (max-width: 980px) {
    .zpb-ai-layout {
        grid-template-columns: 1fr;
    }

    .zpb-ai-sidebar {
        display: none;
    }

    .zpb-ai-main {
        padding: 18px 12px;
    }
}

@media (max-width: 768px) {
    .zpb-user-bubble {
        margin-bottom: 44px;
    }

    .zpb-toolbar {
        gap: 6px;
    }

    .zpb-toolbar button {
        height: 32px;
        padding: 0 12px;
        font-size: 13px;
    }

    .zpb-composer-footer {
        align-items: flex-end;
    }

    .zpb-controls select,
    .zpb-workflow {
        max-width: 155px;
    }
}

@media (max-width: 520px) {
    .zpb-app-intro {
        grid-template-columns: 1fr;
    }

    .zpb-quick-prompts button {
        width: 100%;
    }

    .zpb-ai-message {
        grid-template-columns: 36px minmax(0, 1fr);
        gap: 10px;
    }

    .zpb-message-avatar {
        width: 34px;
        height: 34px;
        font-size: 20px;
    }

    .zpb-toolbar button:nth-child(n+3):not(.zpb-round-btn) {
        display: none;
    }

    .zpb-composer {
        min-height: 128px;
        border-radius: 18px;
    }

    .zpb-workflow {
        display: none;
    }
}
