@import url('css/portals.css');
@import url('css/sidebar.css');
@import url('css/terminal.css');

/* ==========================================================================
   Antigravity Premium Chat Mirror Styles
   Theme: Deep Space Glassmorphism
   ========================================================================== */

/* ==========================================================================
   Antigravity Eye-Friendly Multi-Theme System
   1. 黑曜石沉浸黑 (Obsidian - Default)
   2. 暮光岩板暖灰 (Slate - Anti-Blue Light Warmth)
   3. 深海碧玉幽影 (Emerald - Relaxing Green Spectrum)
   ========================================================================== */

:root, [data-theme="obsidian"] {
    --bg-gradient-start: #090a0f;
    --bg-gradient-end: #0d0f14;
    --bg-radial-center: #11131a;
    --sidebar-bg: rgba(13, 15, 20, 0.7);
    --glass-bg: rgba(18, 20, 28, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-glow: rgba(56, 189, 248, 0.1);
    
    --text-primary: #cbd5e1;
    --text-heading: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #38bdf8;
    --accent-purple: #818cf8;
    --accent-pink: #f472b6;
    --accent-cyan: #22d3ee;
    --accent-emerald: #34d399;
    
    --user-bubble-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.18) 0%, rgba(56, 189, 248, 0.12) 100%);
    --bot-bubble-bg: #141721;
    --header-bg: rgba(12, 14, 19, 0.96);
    --chat-area-bg: rgba(7, 8, 12, 0.4);
    --input-grad-end: rgba(9, 10, 15, 0.96);
    
    --link-color: #38bdf8;
    --link-bg: rgba(56, 189, 248, 0.12);
    --link-border: rgba(56, 189, 248, 0.32);
    --link-glow: rgba(56, 189, 248, 0.45);
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 2. 暮光岩板暖灰 (Twilight Slate - Anti-Blue Light Warmth) */
[data-theme="slate"] {
    --bg-gradient-start: #121316;
    --bg-gradient-end: #18191e;
    --bg-radial-center: #1e2027;
    --sidebar-bg: rgba(22, 23, 29, 0.75);
    --glass-bg: rgba(28, 30, 38, 0.8);
    --glass-border: rgba(255, 255, 255, 0.09);
    --glass-glow: rgba(251, 191, 36, 0.08);
    
    --text-primary: #fde68a;
    --text-heading: #fef08a;
    --text-secondary: #d4b996;
    --text-muted: #927a5d;
    
    --accent-blue: #fbbf24;
    --accent-purple: #f59e0b;
    --accent-pink: #fb7185;
    --accent-cyan: #38bdf8;
    --accent-emerald: #10b981;
    
    --user-bubble-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(217, 119, 6, 0.1) 100%);
    --bot-bubble-bg: #1f2128;
    --header-bg: rgba(20, 21, 26, 0.96);
    --chat-area-bg: rgba(15, 16, 20, 0.4);
    --input-grad-end: rgba(18, 19, 24, 0.96);
    
    --link-color: #fbbf24;
    --link-bg: rgba(251, 191, 36, 0.12);
    --link-border: rgba(251, 191, 36, 0.35);
    --link-glow: rgba(251, 191, 36, 0.4);
}

/* 3. 深海碧玉幽影 (Emerald Abyss - Eye-Relaxing Green Spectrum) */
[data-theme="emerald"] {
    --bg-gradient-start: #041012;
    --bg-gradient-end: #071719;
    --bg-radial-center: #0a2023;
    --sidebar-bg: rgba(6, 20, 23, 0.75);
    --glass-bg: rgba(10, 28, 32, 0.8);
    --glass-border: rgba(34, 197, 94, 0.12);
    --glass-glow: rgba(16, 185, 129, 0.1);
    
    --text-primary: #a7f3d0;
    --text-heading: #bbf7d0;
    --text-secondary: #6ee7b7;
    --text-muted: #34d399;
    
    --accent-blue: #34d399;
    --accent-purple: #2dd4bf;
    --accent-pink: #f43f5e;
    --accent-cyan: #22c55e;
    --accent-emerald: #10b981;
    
    --user-bubble-bg: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(6, 182, 212, 0.12) 100%);
    --bot-bubble-bg: #0d1e21;
    --header-bg: rgba(7, 21, 24, 0.96);
    --chat-area-bg: rgba(4, 13, 15, 0.4);
    --input-grad-end: rgba(6, 18, 20, 0.96);
    
    --link-color: #34d399;
    --link-bg: rgba(52, 211, 153, 0.12);
    --link-border: rgba(52, 211, 153, 0.35);
    --link-glow: rgba(52, 211, 153, 0.45);
}

/* Reset & Core Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    height: var(--vh, 100dvh);
    overflow: hidden !important;
    position: fixed !important;
    top: 0;
    left: 0;
    overscroll-behavior: none;
    background: radial-gradient(circle at 50% 30%, var(--bg-radial-center) 0%, var(--bg-gradient-start) 65%, var(--bg-gradient-end) 100%);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout Structure */
.app-container {
    display: flex;
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}



/* Main Chat Section */
.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    background: var(--chat-area-bg);
    min-width: 0; /* CRITICAL: Prevent Flexbox child width overflow clipping on mobile! */
    width: 100%;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    height: 70px;
    background: var(--header-bg); /* Opacity boosted */
    /*     backdrop-filter: blur(12px); (Disabled to prevent mobile GPU crash) */
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem 0 3.5rem;
    z-index: 60;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Top AI Quota Status Widget (Header Bar) */
.header-quota-widget {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    height: 32px;
    padding: 2px 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    user-select: none;
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    flex-shrink: 0;
}

.header-quota-widget:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(56, 189, 248, 0.35);
    box-shadow: 0 3px 10px rgba(56, 189, 248, 0.15);
}

.header-quota-widget.refreshing {
    animation: quotaPulse 0.8s infinite alternate ease-in-out;
}

@keyframes quotaPulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

.header-quota-row {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1;
}

.header-quota-label {
    font-size: 0.65rem;
    font-family: var(--font-mono, monospace);
    font-weight: 600;
    color: var(--text-muted);
    min-width: 14px;
    line-height: 1;
}

.header-quota-track {
    width: 36px;
    height: 3.5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
}

.header-quota-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease, background 0.3s ease;
}

.header-quota-bar-5h {
    background: linear-gradient(90deg, #38bdf8, #2563eb);
}

.header-quota-bar-weekly {
    background: linear-gradient(90deg, #10b981, #059669);
}

.header-quota-val {
    font-size: 0.65rem;
    font-family: var(--font-mono, monospace);
    font-weight: 600;
    color: var(--text-primary);
    min-width: 30px;
    text-align: right;
    line-height: 1;
}

.header-quota-time {
    font-size: 0.62rem;
    font-family: var(--font-mono, monospace);
    font-weight: 500;
    color: var(--text-muted);
    opacity: 0.85;
    line-height: 1;
    white-space: nowrap;
    margin-left: 2px;
    letter-spacing: -0.2px;
}

.settings-menu-container {
    position: relative;
    display: inline-block;
    z-index: 1000;
}

.settings-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    /*     backdrop-filter: blur(8px); (Disabled to prevent mobile GPU crash) */
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.settings-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.settings-toggle-btn:active {
    transform: scale(0.95);
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: rgba(18, 20, 48, 0.95);
    /*     backdrop-filter: blur(20px) saturate(120%); (Disabled to prevent mobile GPU crash) */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2) inset;
    padding: 1.2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: settingsFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

.settings-dropdown::-webkit-scrollbar {
    width: 4px;
}

.settings-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

@keyframes settingsFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.settings-dropdown.hidden {
    display: none !important;
}

.settings-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.5rem 0;
}

.settings-control-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-control-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.settings-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.6rem;
}

.settings-dropdown-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.option-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.option-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.2;
}


.chat-header h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-heading, var(--text-primary));
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    margin-right: 1rem;
}

/* Switch styling for Auto-scroll */
.switch-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.switch-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.icon-small {
    width: 16px;
    height: 16px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-primary);
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-purple);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Message Stream container */
.message-stream {
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: 0%;
    height: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    padding: 2.5rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Hide for Firefox */
}

/* Custom Scrollbar - Disabled/Hidden */
.message-stream::-webkit-scrollbar {
    display: none; /* Hide for Chrome, Safari, and newer Opera */
}

.message-stream::-webkit-scrollbar-track {
    background: transparent;
}

.message-stream::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.message-stream::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Empty State */
.empty-state {
    margin: auto;
    max-width: 460px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 2rem;
    opacity: 0.85;
}

.empty-icon-glow {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 20px 0 rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
    margin-bottom: 0.5rem;
}

.large-icon {
    width: 32px;
    height: 32px;
}

.empty-state h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
}

.empty-state p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Conversation Message Container */
.message-row {
    display: flex;
    width: 100%;
    animation: messageFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.message-row.user {
    justify-content: flex-end;
}

.message-row.bot {
    justify-content: flex-start;
}

/* Avatar details */
.bot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-right: 0.75rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.avatar-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
}

.avatar-icon {
    width: 18px;
    height: 18px;
    color: #fff;
}

/* Chat bubble styling */
.bubble {
    max-width: 82%;
    border-radius: var(--border-radius-lg);
    padding: 1.25rem 1.75rem;
    position: relative;
    box-shadow: var(--shadow-premium);
    /*     backdrop-filter: blur(12px); (Disabled to prevent mobile GPU crash) */
}

.message-row.user .bubble {
    background: var(--user-bubble-bg);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-bottom-right-radius: 4px;
    color: var(--text-primary);
}

.message-row.bot .bubble {
    background: var(--bot-bubble-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-left-radius: 4px;
}

/* Bubble Header & Footer Info */
.bubble-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.message-row.user .bubble-meta {
    background: transparent;
}

.message-row.bot .bubble-meta {
    background: transparent;
}

.meta-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bubble-meta .sender-name {
    font-weight: 600;
    color: var(--text-secondary);
}

.message-row.user .bubble-meta .sender-name {
    color: var(--accent-purple);
}

.message-row.bot .bubble-meta .sender-name {
    color: var(--accent-cyan);
}

.bubble-meta .time {
    opacity: 0.8;
}

.meta-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.copy-msg-btn,
.speaker-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    transition: var(--transition-smooth);
    padding: 0;
}

.copy-msg-btn:hover,
.speaker-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.copy-msg-btn.copied {
    color: var(--accent-emerald);
}

.speaker-btn.playing {
    color: var(--accent-cyan);
    animation: voiceWave 0.8s infinite alternate ease-in-out;
}

@keyframes voiceWave {
    0% {
        transform: scale(0.95);
        filter: drop-shadow(0 0 1px rgba(6, 182, 212, 0.3));
    }
    100% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.8));
    }
}

/* Markdown Rendering Custom Styles inside bubble */
.bubble-body {
    word-break: break-word;
    font-size: 0.95rem;
}

/* High-Contrast Luminous Pill Links for Eye Comfort & Clarity */
.bubble-body a {
    color: var(--link-color) !important;
    background: var(--link-bg);
    border: 1px solid var(--link-border);
    padding: 0.1em 0.45em;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 500;
    display: inline-block;
    vertical-align: baseline;
    line-height: 1.4;
    margin: 0 2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    word-break: break-all;
}

.bubble-body a:visited {
    color: var(--link-color) !important;
}

.bubble-body a:hover, .bubble-body a:active {
    color: #ffffff !important;
    background: var(--link-border);
    border-color: var(--link-color);
    box-shadow: 0 0 12px var(--link-glow);
    text-decoration: none !important;
    transform: translateY(-1px);
}

.bubble-body p {
    margin-bottom: 0.75rem;
}

.bubble-body p:last-child {
    margin-bottom: 0;
}

.bubble-body h1, .bubble-body h2, .bubble-body h3, .bubble-body h4 {
    font-family: var(--font-heading);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-heading, var(--text-primary));
    font-weight: 600;
}

.bubble-body strong, .bubble-body b {
    color: var(--text-heading, var(--text-primary));
    font-weight: 600;
}

.bubble-body h1 { font-size: 1.4rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); padding-bottom: 0.25rem; }
.bubble-body h2 { font-size: 1.25rem; }
.bubble-body h3 { font-size: 1.1rem; }

.bubble-body ul, .bubble-body ol {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.bubble-body li {
    margin-bottom: 0.25rem;
}

/* Tables inside Markdown */
.bubble-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.bubble-body th, .bubble-body td {
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
}

.bubble-body th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-heading, var(--text-primary));
}

.bubble-body td {
    background: rgba(0, 0, 0, 0.15);
}

/* Code block styles */
.bubble-body pre {
    background: #0d0e15 !important;
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.bubble-body code {
    font-family: monospace;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    color: var(--accent-pink);
}

.bubble-body pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: #e5e7eb;
}

/* Blockquotes */
.bubble-body blockquote {
    border-left: 3px solid var(--accent-purple);
    padding-left: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    border-radius: 0 4px 4px 0;
}

/* Alert Boxes style (GitHub format) */
.bubble-body blockquote.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin: 0.75rem 0;
    border-left: 4px solid var(--accent-purple);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

.bubble-body blockquote.alert-note {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

.bubble-body blockquote.alert-tip {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}

.bubble-body blockquote.alert-important {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.08);
}

.bubble-body blockquote.alert-warning {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.bubble-body blockquote.alert-caution {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.alert-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

.alert-title-note { color: #60a5fa; }
.alert-title-tip { color: #34d399; }
.alert-title-important { color: #c084fc; }
.alert-title-warning { color: #fbbf24; }
.alert-title-caution { color: #f87171; }

.message-row.user .bubble-body {
    white-space: pre-wrap;
}

/* Copy code block helper */
.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.35rem 1rem;
    border-radius: 6px 6px 0 0;
    margin: -1rem -1rem 0.5rem -1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition-smooth);
}

.copy-btn:hover {
    color: #fff;
}

/* Real-time Thinking typing indicator */
.thinking-container {
    display: flex;
    padding: 1rem 4rem;
    margin-top: -1rem;
    margin-bottom: 2rem;
    align-items: center;
}

.thinking-container.hidden {
    display: none;
}

.thinking-bubble {
    background: rgba(30, 41, 59, 0.3);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    border-top-left-radius: 4px;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-premium);
}

.thinking-text {
    font-size: 0.85rem;
}

.wave {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 2px 4px;
}

.wave .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    animation: waveBounce 1.4s infinite ease-in-out;
}

.dot-red { background-color: #ef4444; }
.dot-orange { background-color: #f97316; }
.dot-yellow { background-color: #eab308; }
.dot-green { background-color: #22c55e; }
.dot-cyan { background-color: #06b6d4; }
.dot-blue { background-color: #3b82f6; }
.dot-purple { background-color: #a855f7; }

.wave .dot:nth-child(1) { animation-delay: 0s; }
.wave .dot:nth-child(2) { animation-delay: 0.15s; }
.wave .dot:nth-child(3) { animation-delay: 0.3s; }
.wave .dot:nth-child(4) { animation-delay: 0.45s; }
.wave .dot:nth-child(5) { animation-delay: 0.6s; }
.wave .dot:nth-child(6) { animation-delay: 0.75s; }
.wave .dot:nth-child(7) { animation-delay: 0.9s; }

/* Animations */
@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes pulseGlow {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    100% {
        transform: scale(1.3);
        opacity: 0.75;
    }
}

@keyframes ringRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes messageFadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes waveBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* TTS Settings UI Styles */
.tts-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.setting-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rate-val {
    color: var(--accent-cyan);
    font-weight: 600;
}

.premium-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-family: var(--font-body);
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.premium-select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

.premium-select option {
    background: #0f112a;
    color: var(--text-primary);
}

.premium-range {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.premium-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    box-shadow: 0 0 4px rgba(6, 182, 212, 0.5);
    transition: var(--transition-smooth);
}

.premium-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Responsive adjust */
@media (max-width: 900px) {
    .menu-toggle {
        display: block;
    }
    
    .message-stream {
        padding: 1.5rem 1.5rem;
    }
    
    .thinking-container {
        padding: 0.5rem 1.5rem;
    }
    
    .bubble {
        max-width: 90%;
    }
}

/* Mobile Screen Tuning for Android Edge & other mobile browsers */
@media (max-width: 600px) {
    .chat-header {
        height: auto;
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .header-right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .switch-label {
        font-size: 0.75rem;
    }
    
    .message-stream {
        padding: 1rem 0.5rem 2rem 0.5rem;
        gap: 1.25rem;
    }
    
    .bubble {
        max-width: 94%;
        padding: 0.85rem 1rem;
        border-radius: 12px;
    }
    
    .bot-avatar {
        width: 32px;
        height: 32px;
        margin-right: 0.5rem;
    }
    
    .thinking-container {
        padding: 0.5rem 0.5rem;
    }
    
    .bubble-body {
        font-size: 0.88rem;
    }
    
    .bubble-body pre {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }
    
    .bubble-body code {
        font-size: 0.8rem;
    }
    
    .code-header {
        padding: 0.25rem 0.75rem;
        margin: -0.75rem -0.75rem 0.35rem -0.75rem;
    }
    
    .logo-area {
        font-size: 1.3rem;
    }
    
    .empty-state {
        padding: 1rem;
        max-width: 100%;
    }
}

/* Chat Input Container at the Bottom */
.chat-input-container {
    padding: 1.5rem 4rem;
    background: linear-gradient(180deg, transparent 0%, rgba(9, 10, 15, 0.96) 100%);
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 5;
}

.chat-form {
    display: flex;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
    box-shadow: var(--shadow-premium);
    /*     backdrop-filter: blur(16px); (Disabled to prevent mobile GPU crash) */
    transition: var(--transition-smooth);
    align-items: center;
    gap: 0.75rem;
}

.chat-form:focus-within {
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: 0 0 24px 0 rgba(139, 92, 246, 0.2);
}

.chat-form textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    padding: 0.5rem 0;
}

.chat-form textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

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

.send-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

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

/* Info status bar under input */
.input-info-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-left: 0.5rem;
}

.icon-tiny {
    width: 12px;
    height: 12px;
}

/* Mobile adjustments for input container bottom blocking (Optimized compact spacing!) */
@media (max-width: 768px) {
    .chat-input-container {
        padding: 0.5rem 0.75rem 0.5rem 0.75rem !important;
    }
}

/* Header Voice and Speed Controls */
.header-voice-select-container,
.header-speed-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
    /*     backdrop-filter: blur(8px); (Disabled to prevent mobile GPU crash) */
    transition: var(--transition-smooth);
}

.header-voice-select-container:hover,
.header-speed-container:hover {
    border-color: rgba(139, 92, 246, 0.2);
    background: rgba(255, 255, 255, 0.06);
}

.header-setting-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.premium-select-header {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.premium-select-header option {
    background: #0f112a;
    color: var(--text-primary);
}

.premium-range-header {
    -webkit-appearance: none;
    appearance: none;
    width: 75px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.premium-range-header::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
    transition: var(--transition-smooth);
}

.premium-range-header::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Adjust header layout for extreme cleanliness */
.chat-header {
    height: 70px;
    padding: 0 2rem 0 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 11, 28, 0.95); /* Opacity boosted */
    /*     backdrop-filter: blur(12px); (Disabled to prevent mobile GPU crash) */
    border-bottom: 1px solid var(--glass-border);
    z-index: 60;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-title-main {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: transparent;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.75) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}





/* ==========================================================================
   Mobile Responsive Adjustments (Ultra Streamlined 55px Header!)
   ========================================================================== */
@media (max-width: 900px) {
    .menu-toggle-floating {
        display: flex !important;
    }

    .chat-header {
        height: 55px !important;
        min-height: 55px !important;
        padding: 0 1rem 0 3.5rem !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem !important;
    }
    
    .header-left {
        width: auto !important;
        display: flex !important;
        align-items: center !important;
    }

    .header-right {
        width: auto !important;
        display: flex !important;
        justify-content: flex-end !important;
        gap: 0.85rem !important;
        border-top: none !important;
        padding-top: 0 !important;
    }
    
    .header-title-main {
        font-size: 0.95rem !important;
    }
    
    .switch-label {
        font-size: 0.72rem !important;
    }


}

@media (max-width: 600px) {
    .header-right {
        gap: 0.35rem !important;
    }
    
    .header-quota-widget {
        padding: 2px 4px !important;
        gap: 2px !important;
    }

    .header-quota-row {
        gap: 3px !important;
    }

    .header-quota-track {
        width: 24px !important;
    }

    .header-quota-label,
    .header-quota-val {
        font-size: 0.58rem !important;
    }

    .header-quota-val {
        min-width: 24px !important;
    }

    .header-quota-time {
        font-size: 0.55rem !important;
        margin-left: 1px !important;
        opacity: 0.8 !important;
    }
    
    .switch-label i {
        margin-right: 0.15rem !important;
    }
    
    .switch-label span,
    .switch-label {
        font-size: 0 !important;
    }
    
    .switch-label i {
        font-size: 0.95rem !important;
        color: var(--text-secondary) !important;
    }



    .console-input-bar {
        padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom)) 1rem !important;
    }
}



/* ==========================================================================
   Input Action Toolbar & Upload Styles
   ========================================================================== */
.input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.25rem;
    margin-bottom: 0.15rem;
    font-size: 0.85rem;
    user-select: none;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-status-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font-body);
    transition: color 0.3s ease;
}

.upload-status-text.uploading {
    color: var(--accent-purple);
    font-weight: 500;
}

.upload-status-text.success {
    color: #34d399;
    font-weight: 500;
}

.upload-status-text.error {
    color: #f87171;
    font-weight: 500;
}

.toolbar-right {
    display: flex;
    align-items: center;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.toolbar-btn:hover {
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.35);
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.1);
}

.toolbar-btn:active {
    transform: scale(0.97);
}

.toolbar-btn .icon-small {
    width: 13px;
    height: 13px;
}

.tts-highlight {
    background: linear-gradient(120deg, rgba(255, 51, 102, 0.28) 0%, rgba(255, 77, 79, 0.2) 100%);
    border-radius: 3px;
    padding: 1px 3px;
    color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.45);
    text-decoration: underline;
    text-decoration-color: #ff3366;
    text-underline-offset: 4px;
    text-decoration-thickness: 2.5px;
    animation: pulseHighlight 1.2s infinite alternate ease-in-out;
    display: inline;
}

@keyframes pulseHighlight {
    0% {
        box-shadow: 0 0 6px rgba(255, 51, 102, 0.35);
        text-decoration-color: #ff4d4f;
    }
    100% {
        box-shadow: 0 0 16px rgba(255, 51, 102, 0.75), 0 0 24px rgba(255, 77, 79, 0.45);
        text-decoration-color: #ff2a55;
    }
}

/* Long Message Folding */
.bubble-body.collapsed {
    max-height: 400px;
    overflow: hidden;
    position: relative;
}

.bubble-body.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to top, rgba(10, 11, 22, 0.95) 0%, rgba(10, 11, 22, 0) 100%);
    pointer-events: none;
}

/* User bubbles collapsed gradient matching background */
.chat-row.user-row .bubble-body.collapsed::after {
    background: linear-gradient(to top, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0) 100%);
}

.read-more-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    margin-left: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: var(--transition-smooth);
}

.read-more-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    color: #fff;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.2);
}

.read-more-btn:active {
    transform: scale(0.95);
}





/* ==========================================================================
   Premium login overlay (Deep Space Glassmorphism)
   ========================================================================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: var(--vh, 100dvh);
    background: radial-gradient(circle at 50% 50%, rgba(22, 24, 61, 0.95) 0%, rgba(10, 11, 22, 0.98) 100%);
    /*     backdrop-filter: blur(25px); (Disabled to prevent mobile GPU crash) */
    /*     -webkit-backdrop-filter: blur(25px); (Disabled to prevent mobile GPU crash) */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.5s ease;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.login-card {
    position: relative;
    width: 90%;
    max-width: 420px;
    background: rgba(18, 20, 48, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    padding: 2.5rem 2rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-glow {
    position: absolute;
    top: -50px;
    left: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.login-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.login-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-purple);
    filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
    margin-bottom: 0.5rem;
}

.login-header h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-heading, var(--text-primary));
}

.login-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-input-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.login-input-group label i {
    width: 14px;
    height: 14px;
}

.login-input-field {
    background: rgba(10, 11, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.login-input-field:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.25);
    background: rgba(10, 11, 25, 0.8);
}

.login-error-text {
    color: var(--accent-pink);
    font-size: 0.85rem;
    text-align: center;
    background: rgba(236, 72, 153, 0.1);
    border: 1px solid rgba(236, 72, 153, 0.2);
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    display: block;
}

.login-error-text.hidden {
    display: none;
}

.login-submit-btn {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: var(--border-radius-sm);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.85rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    transition: var(--transition-smooth);
}

.login-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.login-submit-btn:active {
    transform: translateY(0);
}

/* ==========================================================================
   Toolbox and Translation Functionality
   ========================================================================== */

.toolbox-menu-container {
    position: relative;
    display: inline-block;
}

.toolbox-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    /*     backdrop-filter: blur(8px); (Disabled to prevent mobile GPU crash) */
    transition: var(--transition-smooth);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.toolbox-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.toolbox-toggle-btn:active {
    transform: scale(0.95);
}

.toolbox-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 200px;
    background: rgba(18, 20, 48, 0.95);
    /*     backdrop-filter: blur(20px) saturate(120%); (Disabled to prevent mobile GPU crash) */
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 1px rgba(255, 255, 255, 0.2) inset;
    padding: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    animation: settingsFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

.toolbox-dropdown.hidden {
    display: none !important;
}

.toolbox-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.5rem;
}

.toolbox-dropdown-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toolbox-item-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
}

.toolbox-item-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateX(3px);
}

/* ==========================================================================
   Theme Switcher Dropdown Styles
   ========================================================================== */
.theme-menu-container {
    position: relative;
    display: inline-block;
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-right: 8px;
}

.theme-toggle-btn:hover {
    color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.08);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: -20px;
    right: auto;
    width: 240px;
    max-width: calc(100vw - 40px);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.2) inset;
    padding: 0.85rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: settingsFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top left;
}

.theme-dropdown.hidden {
    display: none !important;
}

.theme-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.theme-dropdown-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.theme-item-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: var(--transition-smooth);
}

.theme-item-btn:hover {
    background: rgba(56, 189, 248, 0.12);
    border-color: var(--accent-blue);
    transform: translateX(3px);
}

.theme-item-btn.active {
    background: rgba(56, 189, 248, 0.16);
    border-color: var(--accent-cyan);
}

.theme-preview-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.dot-obsidian {
    background: linear-gradient(135deg, #090a0f 45%, #38bdf8 55%);
}

.dot-slate {
    background: linear-gradient(135deg, #1f2128 45%, #fbbf24 55%);
}

.dot-emerald {
    background: linear-gradient(135deg, #0d1e21 45%, #34d399 55%);
}

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

.theme-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.theme-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.theme-check-icon {
    width: 15px;
    height: 15px;
    color: var(--accent-emerald);
    flex-shrink: 0;
}

/* Translate Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 6, 18, 0.75);
    /*     backdrop-filter: blur(8px); (Disabled to prevent mobile GPU crash) */
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none !important;
}

.translate-panel {
    background: rgba(18, 20, 48, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.translate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.translate-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading, var(--text-primary));
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.translate-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.translate-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.translate-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.translate-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.translate-lang-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.translate-select {
    background: rgba(10, 11, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: #fff;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

.translate-select:focus {
    border-color: var(--accent-purple);
}

.translate-textarea {
    background: rgba(10, 11, 25, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-md);
    color: #fff;
    padding: 0.75rem;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    height: 100px;
    outline: none;
    transition: var(--transition-smooth);
}

.translate-textarea:focus {
    border-color: var(--accent-purple);
    background: rgba(10, 11, 25, 0.8);
}

.translate-textarea[readonly] {
    background: rgba(255, 255, 255, 0.02);
    cursor: default;
}

.translate-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.translate-submit-btn {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    border: none;
    border-radius: var(--border-radius-sm);
    color: #fff;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.translate-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.translate-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.translate-copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-smooth);
}

.translate-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}



/* Antigravity Shortcuts Modal */
.antigravity-panel {
    background: rgba(18, 20, 48, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.antigravity-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 0.5rem;
}

@media (max-width: 480px) {
    .antigravity-grid {
        grid-template-columns: 1fr;
    }
}

.antigravity-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: left;
}

.antigravity-card:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(139, 92, 246, 0.1);
}

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

.antigravity-card.executing {
    border-color: var(--accent-emerald) !important;
    background: rgba(16, 185, 129, 0.1) !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2) !important;
}

.antigravity-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-purple);
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.antigravity-card:hover .antigravity-card-icon {
    background: var(--accent-purple);
    color: #fff;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.antigravity-card-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.antigravity-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-heading, var(--text-primary));
}

.antigravity-card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* ==========================================================================
   Premium Select Trigger Button (inside Settings Dropdown)
   ========================================================================== */
.premium-select-trigger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--border-radius-sm);
    padding: 0.55rem 1rem;
    color: #c084fc;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    width: 100%;
    transition: var(--transition-smooth);
}

.premium-select-trigger-btn:hover {
    border-color: rgba(139, 92, 246, 0.6);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25) 0%, rgba(59, 130, 246, 0.15) 100%);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
    transform: translateY(-1px);
}

.premium-select-trigger-btn:active {
    transform: translateY(0);
}

/* ==========================================================================
   Premium Account Switcher Modal Popup
   ========================================================================== */
.premium-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 11, 28, 0.95); /* Opacity boosted */
    /*     backdrop-filter: blur(12px) saturate(140%); (Disabled to prevent mobile GPU crash) */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.premium-modal-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.premium-modal-box {
    background: rgba(18, 20, 48, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-md);
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.15) inset;
    animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.premium-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.premium-modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.premium-modal-title-group h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-heading, var(--text-primary));
    letter-spacing: 0.5px;
}

.modal-icon {
    color: var(--accent-purple);
    width: 20px;
    height: 20px;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.premium-modal-body {
    padding: 1.2rem 1.5rem 1.5rem;
}

.modal-account-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Scrollbar styling for list */
.modal-account-list::-webkit-scrollbar {
    width: 4px;
}
.modal-account-list::-webkit-scrollbar-track {
    background: transparent;
}
.modal-account-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}
.modal-account-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Account card item styles */
.account-card {
    display: flex;
    align-items: center;
    background: rgba(15, 17, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
}

.account-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: transparent;
    transition: all 0.2s ease;
}

.account-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(139, 92, 246, 0.25);
    transform: translateX(2px);
}

.account-card.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(59, 130, 246, 0.06) 100%);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.account-card.active::before {
    background: var(--accent-purple);
}

.account-avatar {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
    transition: all 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.account-card.active .account-avatar {
    background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-blue) 100%);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
    border-color: transparent;
}

.account-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.account-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.account-card.active .account-name {
    color: var(--text-heading, var(--text-primary));
}

.account-role {
    font-size: 0.68rem;
    color: var(--text-secondary);
    opacity: 0.7;
}

.account-card.active .account-role {
    color: var(--accent-blue);
    opacity: 0.95;
}

.account-status-dot {
    margin-left: auto;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.account-card.active .account-status-dot {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.account-card.disabled {
    pointer-events: none;
    opacity: 0.5;
}

.account-card.loading .account-status-dot {
    background: transparent;
    border: 1.5px solid var(--accent-purple);
    border-top-color: transparent;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    animation: accountSpin 0.6s linear infinite;
    box-shadow: none;
}

@keyframes accountSpin {
    to { transform: rotate(360deg); }
}

/* Server Card Styles */
.server-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition-smooth);
    position: relative;
}

.server-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.server-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.server-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-heading, var(--text-primary));
}

.server-card-title span.server-name {
    font-weight: 700;
}

.server-card-title button.server-edit-name-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: var(--transition-smooth);
}

.server-card-title button.server-edit-name-btn:hover {
    color: var(--text-primary);
}

.server-badges {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.server-status-badge {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #10b981;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.server-status-dot-inner {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    display: inline-block;
}

.server-type-badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.server-type-badge.control-center {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: var(--accent-purple);
}

.server-ips {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.15rem;
}

.server-ips span.ip-label {
    color: var(--text-muted);
}

.server-ips span.ip-val {
    color: var(--text-primary);
    margin-right: 0.25rem;
}

.server-spec {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.15rem;
}

.server-spec span.spec-val {
    font-weight: 600;
    color: var(--text-primary);
}

.server-created {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.server-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.flex-row {
    margin-bottom: 0.75rem;
}

/* Server List Status & Separator */
.server-status-badge.stopped {
    background: rgba(239, 68, 68, 0.15) !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
    color: #f87171 !important;
}
.server-status-badge.stopped .server-status-dot-inner {
    background-color: #ef4444 !important;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.8) !important;
}

/* Make stopped server cards semi-transparent to contrast with active ones */
.server-card:has(.server-status-badge.stopped) {
    opacity: 0.65;
    border-color: rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.02);
}
.server-card:has(.server-status-badge.stopped):hover {
    opacity: 0.85;
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.25);
}

.server-list-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f87171;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin: 2rem 0 1.5rem 0;
    width: 100%;
}
.server-list-separator::before,
.server-list-separator::after {
    content: '';
    flex: 1;
    border-bottom: 2px dashed rgba(239, 68, 68, 0.35);
}
.server-list-separator::before {
    margin-right: 1.25rem;
}
.server-list-separator::after {
    margin-left: 1.25rem;
}

/* ==========================================================================
   Image Processing Modal
   ========================================================================== */
.image-panel {
    background: rgba(18, 20, 48, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-lg);
    width: 95%;
    max-width: 750px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.image-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-heading, var(--text-primary));
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.image-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-height: 80vh;
    overflow-y: auto;
}

.image-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--border-radius-md);
    padding: 3rem 1rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.image-dropzone:hover, .image-dropzone.dragover {
    border-color: var(--accent-purple);
    background: rgba(139, 92, 246, 0.05);
}

.dropzone-icon {
    width: 48px;
    height: 48px;
    color: var(--accent-purple);
    opacity: 0.8;
}

.dropzone-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.image-workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.image-previews-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 600px) {
    .image-previews-container {
        grid-template-columns: 1fr;
    }
}

.preview-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.preview-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.size-badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    color: var(--text-primary);
}

.preview-box {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
    border-radius: var(--border-radius-sm);
    aspect-ratio: 4/3;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-controls {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.control-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.inline-controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.inline-controls label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-control-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
}

.toggle-control-label input[type="checkbox"] {
    display: none;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    position: relative;
    background: rgba(10, 11, 25, 0.6);
    transition: var(--transition-smooth);
}

.toggle-control-label input[type="checkbox"]:checked + .custom-checkbox {
    background: var(--accent-purple);
    border-color: var(--accent-purple);
}

.toggle-control-label input[type="checkbox"]:checked + .custom-checkbox::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.slider-control-row {
    gap: 0.75rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

#img-quality-val {
    color: var(--accent-purple);
    font-family: monospace;
}

/* Global utility class to hide elements securely */
.hidden {
    display: none !important;
}

/* Premium Image Dropzone Custom Upload Button */
.dropzone-upload-btn {
    margin-top: 1.25rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--accent-purple, #8b5cf6), #7c3aed);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-md, 8px);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
}

.dropzone-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.45);
    background: linear-gradient(135deg, #9b6bf7, #8b5cf6);
}

.dropzone-upload-btn:active {
    transform: translateY(0);
}

/* Upload Dropdown Menu Styles */
.upload-dropdown-container {
    position: relative;
    display: inline-block;
}

.upload-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: rgba(15, 23, 42, 0.85); /* Sleek dark slate background */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.35rem;
    min-width: 120px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 15px rgba(139, 92, 246, 0.15); /* Purple accent glow */
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 100;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-menu.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.upload-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.upload-menu-item:hover {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-primary);
}

.upload-menu-item i {
    width: 14px;
    height: 14px;
}

/* Custom Dropdown Option B styles */
.dropdown-option {
    text-align: left;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
}
.dropdown-option:hover {
    background: rgba(139, 92, 246, 0.15);
    color: var(--text-primary);
}
.dropdown-option.active {
    background: var(--accent-purple);
    color: #fff;
}

/* Chat Message Image Previews & Lightbox Zoom Support */
.bubble-body img,
img.chat-image-preview {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    margin: 0.6rem 0;
    display: block;
    cursor: zoom-in !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.bubble-body img:hover,
img.chat-image-preview:hover {
    transform: scale(1.01);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
    border-color: rgba(139, 92, 246, 0.5);
}

/* ==========================================================================
   Mermaid SVG Diagram Styling & Code Fullscreen Modal
   ========================================================================== */
.mermaid-container {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 10px;
    margin: 1rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    transition: border-color 0.2s ease;
    overflow: hidden;
}

.mermaid-container:hover {
    border-color: rgba(139, 92, 246, 0.5);
}

.mermaid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.85);
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mermaid-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.mermaid-viewport {
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    text-align: center;
    cursor: zoom-in;
    display: flex;
    justify-content: center;
}

.mermaid-viewport svg {
    min-width: min(100%, max-content);
    max-width: none !important;
    height: auto !important;
    font-family: var(--font-body) !important;
}

@media (max-width: 768px) {
    .mermaid-viewport {
        justify-content: flex-start;
        padding: 0.75rem 0.5rem;
    }
    .mermaid-viewport svg {
        min-width: 520px;
    }
}

/* Mermaid SVG Minimalist Fullscreen Lightbox */
.mermaid-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    background: rgba(5, 7, 13, 0.94);
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
}

.mermaid-modal-header-minimal {
    position: absolute;
    top: max(1rem, env(safe-area-inset-top, 1rem));
    right: 1.25rem;
    z-index: 10002;
    display: flex;
    align-items: center;
}

.mermaid-close-pill-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f3f4f6;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.mermaid-close-pill-btn:hover {
    background: rgba(239, 68, 68, 0.85);
    border-color: rgba(239, 68, 68, 1);
    transform: scale(1.08);
}

.mermaid-modal-body {
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    cursor: grab;
    position: relative;
    padding-bottom: 5.5rem;
}

.mermaid-modal-body:active {
    cursor: grabbing;
}

.mermaid-canvas-wrapper {
    display: inline-block;
    transform-origin: center center;
    transition: transform 0.05s ease-out;
    will-change: transform;
}

.mermaid-canvas-wrapper svg {
    max-width: 90vw;
    max-height: 75vh;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.8));
}

/* Bottom Ergonomic Dock (Single-thumb control) */
.mermaid-bottom-dock {
    position: absolute;
    bottom: max(3.5rem, calc(env(safe-area-inset-bottom, 1.5rem) + 2.5rem));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 30px;
    padding: 0.6rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    backdrop-filter: blur(18px);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.7), 0 0 15px rgba(139, 92, 246, 0.2);
    width: min(88vw, 360px);
}

.mermaid-zoom-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
    min-width: 42px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.mermaid-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    outline: none;
    cursor: pointer;
}

.mermaid-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.6);
    transition: transform 0.1s ease;
}

.mermaid-slider::-webkit-slider-thumb:active {
    transform: scale(1.25);
}

.mermaid-dock-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.mermaid-dock-btn:hover,
.mermaid-dock-btn:active {
    background: rgba(139, 92, 246, 0.25);
    color: var(--text-primary);
    border-color: rgba(139, 92, 246, 0.5);
    transform: scale(1.05);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(30, 41, 59, 0.85);
    padding: 0.35rem 0.75rem;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.code-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.code-actions button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

/* Code Fullscreen Immersive Modal */
.code-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.code-modal-content {
    background: #0f172a;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    width: 95vw;
    max-width: 1200px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.code-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-modal-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

.code-modal-body {
    flex: 1;
    overflow: auto;
    padding: 1rem;
}

.code-modal-body pre {
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    height: 100%;
}

.code-modal-body code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ==========================================================================
   Chat Message Image Cards & Immersive Fullscreen Lightbox Modal
   ========================================================================== */
.chat-image-card {
    margin: 0.75rem 0;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    overflow: hidden;
    max-width: min(100%, 640px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: zoom-in;
    user-select: none;
}

.chat-image-card:hover {
    border-color: rgba(139, 92, 246, 0.65);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.25);
    transform: translateY(-1px);
}

.chat-image-card.auto-promoted {
    border-left: 3px solid #06b6d4;
}

.chat-image-wrapper {
    position: relative;
    cursor: zoom-in;
    background: #080c14;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    max-height: 480px;
    overflow: hidden;
}

.chat-image-wrapper img.chat-image-preview {
    max-width: 100%;
    max-height: 480px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    cursor: zoom-in !important;
    transition: transform 0.25s ease;
}

.chat-image-card:hover .chat-image-wrapper img.chat-image-preview {
    transform: scale(1.02);
}

.chat-image-overlay-badge {
    display: none !important;
}

.chat-image-caption {
    padding: 0.55rem 0.9rem;
    background: rgba(15, 23, 42, 0.92);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text-secondary, #94a3b8);
}

.chat-image-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    font-weight: 500;
    color: #e2e8f0;
}

.chat-image-error-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem 1rem;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.82rem;
}

/* Fullscreen Immersive Lightbox Modal */
.image-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    background: rgba(4, 6, 11, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 10005;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    opacity: 1;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-lightbox-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.image-lightbox-header {
    position: absolute;
    top: max(0.85rem, env(safe-area-inset-top, 0.85rem));
    left: 1rem;
    right: 1rem;
    z-index: 10008;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: auto;
}

.image-lightbox-title-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 0.4rem 0.85rem;
    color: #f3f4f6;
    font-size: 0.82rem;
    font-weight: 500;
    max-width: 60vw;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.image-lightbox-filename {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-lightbox-header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.image-lightbox-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: 0.45rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: #f3f4f6;
    font-size: 0.8rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.image-lightbox-btn:hover {
    background: rgba(139, 92, 246, 0.85);
    border-color: rgba(139, 92, 246, 1);
    transform: scale(1.05);
}

.image-lightbox-btn.close-btn {
    border-radius: 50%;
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
}

.image-lightbox-btn.close-btn:hover {
    background: rgba(239, 68, 68, 0.85);
    border-color: rgba(239, 68, 68, 1);
}

.image-lightbox-body {
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    cursor: grab;
    position: relative;
    padding-bottom: 5.5rem;
}

.image-lightbox-body:active {
    cursor: grabbing;
}

.image-lightbox-stage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    transition: transform 0.05s ease-out;
    will-change: transform;
}

.image-lightbox-stage img {
    max-width: 92vw;
    max-height: 80vh;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.85));
    border-radius: 6px;
    pointer-events: auto;
    cursor: zoom-out;
}

/* Bottom Ergonomic Dock (Single-thumb control on mobile) */
.image-lightbox-dock {
    position: absolute;
    bottom: max(2.5rem, calc(env(safe-area-inset-bottom, 1rem) + 1.8rem));
    left: 50%;
    transform: translateX(-50%);
    z-index: 10008;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(139, 92, 246, 0.45);
    border-radius: 30px;
    padding: 0.55rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.75), 0 0 20px rgba(139, 92, 246, 0.25);
    width: min(90vw, 380px);
}

.image-lightbox-dock .lightbox-dock-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-cyan, #06b6d4);
    min-width: 44px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.image-lightbox-dock .lightbox-dock-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.18);
    outline: none;
    cursor: pointer;
}

.image-lightbox-dock .lightbox-dock-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.6);
    transition: transform 0.1s ease;
}

.image-lightbox-dock .lightbox-dock-slider::-webkit-slider-thumb:active {
    transform: scale(1.25);
}

.image-lightbox-dock .lightbox-dock-icon-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-lightbox-dock .lightbox-dock-icon-btn:hover {
    background: rgba(139, 92, 246, 0.5);
    color: #ffffff;
    transform: scale(1.08);
}

/* ==========================================================================
   KaTeX Mathematical Formula Styling & Responsiveness
   ========================================================================== */
.katex-display {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.6em 0;
    margin: 0.6em 0;
    -webkit-overflow-scrolling: touch;
}

.katex {
    font-size: 1.05em;
    text-rendering: auto;
}

.katex-html {
    white-space: normal;
}

.katex-error {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono, monospace);
    font-size: 0.9em;
}

/* ==========================================================================
   Matrix Tasks & Logs Radar Button & Breathing Dot
   ========================================================================== */
.task-logs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-right: 8px;
    position: relative;
    flex-shrink: 0;
}

.task-logs-btn:hover {
    color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.08);
}

.task-logs-btn:active {
    transform: scale(0.95);
}

.radar-indicator-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    transition: all 0.3s ease;
}

.radar-indicator-dot.dot-healthy {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
    animation: radarBreathGreen 2.2s infinite ease-in-out;
}

.radar-indicator-dot.dot-standby {
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
    animation: radarBreathYellow 2.2s infinite ease-in-out;
}

.radar-indicator-dot.dot-error {
    background: #ef4444;
    box-shadow: 0 0 8px #ef4444;
    animation: radarBreathRed 1.4s infinite ease-in-out;
}

@keyframes radarBreathGreen {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.15); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes radarBreathYellow {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { transform: scale(1.15); box-shadow: 0 0 0 7px rgba(245, 158, 11, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes radarBreathRed {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); }
    70% { transform: scale(1.2); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Theme Switcher in Settings */
.theme-settings-group .theme-dropdown-body.in-settings {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

/* ==========================================================================
   Matrix Tasks & Logs Monitor Modal Styles (Mobile Radar & Universal Drawer)
   ========================================================================== */
.matrix-monitor-panel {
    position: relative;
    width: 960px;
    max-width: 95vw;
    max-height: 88vh;
    background: rgba(13, 15, 20, 0.96);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--border-radius-lg, 14px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: settingsFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.matrix-monitor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.matrix-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.matrix-title-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
}

.matrix-pulse-icon {
    animation: pulse 2s infinite ease-in-out;
}

.matrix-title-text h3 {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 700;
    color: #f3f4f6;
    letter-spacing: -0.01em;
}

.matrix-subtitle {
    font-size: 0.7rem;
    color: #94a3b8;
}

.matrix-overall-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}

.matrix-overall-badge .matrix-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.matrix-overall-badge.badge-healthy {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.matrix-overall-badge.badge-healthy .matrix-badge-dot {
    background: #10b981;
    box-shadow: 0 0 5px #10b981;
}

.matrix-overall-badge.badge-standby {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.matrix-overall-badge.badge-standby .matrix-badge-dot {
    background: #f59e0b;
    box-shadow: 0 0 5px #f59e0b;
}

.matrix-overall-badge.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.matrix-overall-badge.badge-error .matrix-badge-dot {
    background: #ef4444;
    box-shadow: 0 0 5px #ef4444;
}

.matrix-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.matrix-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 0.78rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    cursor: pointer;
    transition: all 0.2s;
}
.matrix-header-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}
.matrix-header-btn.rotating i {
    animation: spin 0.6s linear infinite;
}

.matrix-close-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
}
.matrix-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.matrix-monitor-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 1.15rem 1.25rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* 顶部横向滑动分类胶囊栏 */
.matrix-filter-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 2px 6px 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.matrix-filter-pills::-webkit-scrollbar {
    display: none;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: #94a3b8;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.pill-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.2);
}
.pill-btn.active {
    background: rgba(56, 189, 248, 0.18);
    border-color: #38bdf8;
    color: #38bdf8;
    font-weight: 600;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

/* 紧凑卡片网格容器 */
.matrix-cards-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.matrix-cards-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #94a3b8;
    padding: 0 2px;
}

.matrix-section-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #cbd5e1;
}

.matrix-count-badge {
    font-size: 0.68rem;
    padding: 1px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

.matrix-refresh-tip {
    font-size: 0.7rem;
    color: #64748b;
}

/* 紧凑卡片网格：桌面自适应，移动端双列 */
.matrix-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 8px;
}

/* 紧凑卡片（高度压缩至 64px~70px） */
.matrix-card-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 7px 9px;
    height: 68px;
    min-height: 68px;
    max-height: 68px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
    box-sizing: border-box;
}

.matrix-card-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-1px);
}

.matrix-card-item.is-pinned {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.04);
}

.matrix-card-item.selected {
    background: rgba(56, 189, 248, 0.12);
    border-color: #38bdf8;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

/* 卡片微排布：顶部行 */
.card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.card-title-group {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.card-icon {
    width: 14px;
    height: 14px;
    color: #38bdf8;
    flex-shrink: 0;
}

.card-name {
    font-size: 0.76rem;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-status-group {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.card-pin-indicator {
    display: inline-flex;
    align-items: center;
    color: #f59e0b;
    font-size: 11px;
    line-height: 1;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.card-healthy .status-dot,
.status-healthy .status-dot {
    background: #10b981;
    box-shadow: 0 0 5px #10b981;
}

.card-standby .status-dot,
.status-standby .status-dot {
    background: #f59e0b;
    box-shadow: 0 0 5px #f59e0b;
}

.card-warning .status-dot,
.status-warning .status-dot {
    background: #f97316;
    box-shadow: 0 0 5px #f97316;
}

.card-error .status-dot,
.status-error .status-dot {
    background: #ef4444;
    box-shadow: 0 0 5px #ef4444;
}

/* 卡片微排布：底部行 */
.card-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 0.68rem;
    color: #94a3b8;
}

.card-metric-snippet {
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-category-tag {
    font-size: 0.6rem;
    text-transform: uppercase;
    padding: 1px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    flex-shrink: 0;
}

/* ==========================================================================
   Universal Detail Drawer (通用复用型独立任务详情看板/底部抽屉)
   ========================================================================== */
.matrix-detail-drawer {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    pointer-events: auto;
}

.matrix-detail-drawer.hidden {
    display: none !important;
    pointer-events: none !important;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    animation: fadeInBackdrop 0.2s ease;
}

@keyframes fadeInBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.drawer-panel {
    position: relative;
    width: 100%;
    max-height: 85vh;
    background: rgba(13, 16, 23, 0.97);
    backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpDrawer 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpDrawer {
    from {
        transform: translateY(100%);
        opacity: 0.5;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.drawer-handle-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 7px 0 3px 0;
    cursor: pointer;
}

.drawer-handle {
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.25);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.drawer-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
    flex-shrink: 0;
}

.drawer-title-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.drawer-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.drawer-title-row h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: #f8fafc;
}

.drawer-category-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    text-transform: uppercase;
}

.drawer-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
}

.drawer-status-badge.status-healthy {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}
.drawer-status-badge.status-standby {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}
.drawer-status-badge.status-warning {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
}
.drawer-status-badge.status-error {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.drawer-meta-row {
    font-size: 0.7rem;
    color: #64748b;
}

.drawer-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.drawer-pin-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.drawer-pin-btn:hover {
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.1);
}
.drawer-pin-btn.active {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #f59e0b;
}

.drawer-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.drawer-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.drawer-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #cbd5e1;
}

/* 特有指标网格 */
.detail-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.detail-metric-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 6px;
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.detail-metric-key {
    font-size: 0.68rem;
    color: #94a3b8;
}

.detail-metric-val {
    font-size: 0.82rem;
    font-weight: 600;
    color: #f1f5f9;
    font-family: 'JetBrains Mono', monospace;
    word-break: break-all;
}

/* 专属实时日志视口 */
.drawer-terminal-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawer-terminal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}

.drawer-terminal-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
    font-weight: 600;
    color: #cbd5e1;
}

.drawer-terminal-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.matrix-autoscroll-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: #94a3b8;
    cursor: pointer;
}

.matrix-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 7px;
    font-size: 0.72rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}
.matrix-tool-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

.detail-terminal-viewport {
    background: #080a0f;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 150px;
    max-height: 240px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', 'Menlo', monospace;
    font-size: 11px;
    line-height: 1.45;
    color: #cbd5e1;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
}

.matrix-terminal-lines {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.terminal-line {
    word-break: break-all;
    white-space: pre-wrap;
}

.terminal-line .line-time {
    color: #64748b;
    margin-right: 4px;
}

.terminal-line .line-proj {
    font-weight: 600;
    margin-right: 4px;
}

.terminal-line .line-proj.tag-quant-core { color: #38bdf8; }
.terminal-line .line-proj.tag-shumen-core { color: #a78bfa; }
.terminal-line .line-proj.tag-xianyu-protocol-bridge { color: #f59e0b; }
.terminal-line .line-proj.tag-agy-worker-swarm { color: #10b981; }
.terminal-line .line-proj.tag-chat-mirror { color: #ec4899; }
.terminal-line .line-proj.tag-check_ports { color: #06b6d4; }
.terminal-line .line-proj.tag-check_node_load { color: #14b8a6; }

.terminal-line .line-level {
    font-weight: 600;
    margin-right: 6px;
}

.terminal-line .line-level.lvl-info { color: #38bdf8; }
.terminal-line .line-level.lvl-warn { color: #fbbf24; }
.terminal-line .line-level.lvl-err { color: #f87171; }

.terminal-line.err {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.08);
    padding: 1px 3px;
    border-radius: 2px;
}

.terminal-line.warn {
    color: #fde68a;
}

.terminal-line.system {
    color: #94a3b8;
    font-style: italic;
}

/* 抽屉底部操作动作栏 */
.drawer-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0.75rem 1.15rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.25);
    flex-wrap: wrap;
}

.drawer-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.drawer-action-btn.btn-run {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
}
.drawer-action-btn.btn-run:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: #10b981;
}

.drawer-action-btn.btn-restart {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fbbf24;
}
.drawer-action-btn.btn-restart:hover {
    background: rgba(245, 158, 11, 0.25);
    border-color: #f59e0b;
}

.drawer-action-btn.btn-refresh {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
}
.drawer-action-btn.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.12);
}

.icon-nano {
    width: 12px;
    height: 12px;
}

/* ==========================================================================
   移动端 (360px ~ 430px) 手持竖屏极致响应式优化
   ========================================================================== */
@media (max-width: 600px) {
    .task-logs-btn {
        width: 30px !important;
        height: 30px !important;
        margin-right: 2px !important;
    }

    .matrix-monitor-panel {
        width: 98vw !important;
        max-width: 98vw !important;
        max-height: 95vh !important;
        border-radius: 10px !important;
    }

    .matrix-monitor-header {
        padding: 0.65rem 0.8rem !important;
    }

    .matrix-title-text h3 {
        font-size: 0.88rem !important;
    }

    .matrix-subtitle {
        display: none !important;
    }

    .matrix-overall-badge {
        font-size: 0.66rem !important;
        padding: 2px 6px !important;
    }

    .matrix-monitor-body {
        padding: 0.65rem 0.75rem !important;
        gap: 0.65rem !important;
    }

    /* 移动端强制紧凑双列网格 */
    .matrix-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .matrix-card-item {
        height: 66px !important;
        min-height: 66px !important;
        max-height: 66px !important;
        padding: 6px 7px !important;
    }

    .card-name {
        font-size: 0.72rem !important;
    }

    .card-metric-snippet {
        font-size: 0.64rem !important;
    }

    /* 抽屉移动端沉浸式贴底 */
    .drawer-panel {
        max-height: 90vh !important;
        border-radius: 14px 14px 0 0 !important;
    }

    .drawer-header {
        padding: 0.45rem 0.8rem !important;
    }

    .drawer-title-row h4 {
        font-size: 0.86rem !important;
    }

    .drawer-body {
        padding: 0.65rem 0.8rem !important;
        gap: 0.65rem !important;
    }

    .detail-metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .detail-terminal-viewport {
        font-size: 10px !important;
        padding: 6px 8px !important;
        min-height: 120px !important;
        max-height: 180px !important;
    }

    .drawer-footer {
        padding: 0.55rem 0.8rem !important;
        justify-content: space-between !important;
    }

    .drawer-action-btn {
        padding: 5px 9px !important;
        font-size: 0.72rem !important;
        flex: 1 !important;
        justify-content: center !important;
    }
}




