#main_bg {
    background-image: url(../assets/images/background/index_bg.jpg);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    position: fixed;
    min-height: 100vh;
    width: 100%;
    background-attachment: fixed;
    z-index: -1;
}

#panel.chatgpt-panel {
    --chat-surface: rgba(15, 23, 42, 0.92);
    --chat-surface-2: rgba(30, 41, 59, 0.96);
    --chat-border: rgba(148, 163, 184, 0.24);
    --chat-text: #e2e8f0;
    --chat-muted: #94a3b8;
    --chat-accent: #2563eb;
    --chat-accent-strong: #1d4ed8;
    overflow: hidden;
}

#panel.chatgpt-panel .tool-shell {
    gap: 12px;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto 1fr;
}

#panel.chatgpt-panel .tool-head {
    background: rgba(10, 16, 30, 0.82);
    color: #e2e8f0;
}

#panel.chatgpt-panel .tool-head p {
    color: #cbd5e1;
}

#panel.chatgpt-panel #toolMain.card {
    min-height: 0;
    display: flex;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.chat-tool {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    margin: 0;
    background: var(--chat-surface);
    border: 1px solid var(--chat-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 16px;
    overflow-y: auto;
    padding: 22px 20px 14px;
}

.chat-empty-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--chat-muted);
    padding: 48px 18px 36px;
}

.chat-home {
    width: 100%;
    max-width: 720px;
    display: grid;
    gap: 22px;
}

.chat-home-header {
    display: grid;
    gap: 8px;
}

.chat-home-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    color: var(--chat-text);
    font-size: 12px;
    letter-spacing: 0.04em;
    width: fit-content;
    margin: 0 auto;
}

.chat-empty-state h2 {
    margin: 0;
    font-size: 28px;
    color: #f8fafc;
}

.chat-empty-state p {
    margin: 0;
}

.quick-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.prompt-card {
    text-align: left;
    background: var(--chat-surface-2);
    border: 1px solid var(--chat-border);
    color: var(--chat-text);
    padding: 14px 16px;
    border-radius: 14px;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.prompt-card:hover {
    transform: translateY(-2px);
    border-color: rgba(148, 163, 184, 0.5);
    background: rgba(30, 41, 59, 0.9);
}

.prompt-title {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.prompt-desc {
    display: block;
    font-size: 12px;
    color: var(--chat-muted);
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 14px;
    line-height: 1.6;
}

.chat-message-header {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.78;
}

.chat-role {
    font-weight: 600;
}

.chat-message-body {
    font-size: 14px;
    word-break: break-word;
    color: inherit;
}

.chat-message-body > * {
    margin: 0 0 10px;
}

.chat-message-body > *:last-child {
    margin-bottom: 0;
}

.chat-message-body ul,
.chat-message-body ol {
    padding-left: 18px;
    margin: 0 0 10px;
}

.chat-message-body li {
    margin: 4px 0;
}

.chat-message-body a {
    color: #7dd3fc;
    text-decoration: underline;
}

.chat-message-body blockquote {
    margin: 0 0 10px;
    padding-left: 12px;
    border-left: 3px solid rgba(148, 163, 184, 0.45);
    color: var(--chat-muted);
}

.chat-message-body pre {
    background: #0b1120;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 12px;
    overflow: auto;
    font-size: 12px;
    line-height: 1.6;
}

.chat-message-body code {
    background: rgba(15, 23, 42, 0.6);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
}

.chat-message-body pre code {
    background: transparent;
    padding: 0;
}

.chat-message-body img {
    max-width: 100%;
    border-radius: 10px;
    display: block;
}

.chat-message-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 10px;
    font-size: 12px;
}

.chat-message-body th,
.chat-message-body td {
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 6px 8px;
    text-align: left;
}

.chat-message-body hr {
    border: none;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    margin: 12px 0;
}

.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--chat-accent), #3b82f6);
    color: #fff;
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--chat-surface-2);
    border: 1px solid var(--chat-border);
    color: var(--chat-text);
}

.chat-input-wrap {
    border-top: 1px solid var(--chat-border);
    background: rgba(15, 23, 42, 0.96);
    padding: 14px;
}

.chat-input-shell {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    border: 1px solid var(--chat-border);
    border-radius: 14px;
    background: #0b1120;
    padding: 10px 12px;
}

.chat-input-shell:focus-within {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

#chatInput {
    width: 100%;
    min-height: 48px;
    max-height: 160px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--chat-text);
    padding: 6px 4px;
    box-sizing: border-box;
    resize: none;
    outline: none;
}

.chat-input-toolbar {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.chat-input-toolbar .hint {
    margin: 0;
    color: var(--chat-muted);
    font-size: 12px;
    flex: 1;
}

.ghost-btn {
    background: transparent;
    border: 1px solid var(--chat-border);
    color: var(--chat-text);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--chat-accent);
    border: none;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.send-btn:hover {
    background: var(--chat-accent-strong);
    transform: translateY(-1px);
}

.send-btn:disabled {
    background: rgba(37, 99, 235, 0.4);
    cursor: not-allowed;
    transform: none;
}

.send-btn svg {
    width: 18px;
    height: 18px;
}

.typing-dot {
    animation: blink 1.2s infinite;
    margin-right: 4px;
    opacity: 0.45;
}

.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }

#panel.chatgpt-panel .workbench-textarea {
    min-height: 72px;
    max-height: 120px;
}

#panel.chatgpt-panel .workbench-toolbar {
    margin-bottom: 6px;
}

@keyframes blink {
    0%, 80%, 100% { opacity: .25; }
    40% { opacity: 1; }
}

@media (max-width: 900px) {
    .chat-input-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .chat-message {
        max-width: 100%;
    }
}
