        /* ---------- 布局 ---------- */
        #app {
            display: flex;
            height: 100vh;
            width: 100%;
            background:
                radial-gradient(900px 420px at 12% -12%, rgba(108, 140, 255, 0.07), transparent 62%),
                radial-gradient(800px 420px at 88% 112%, rgba(154, 108, 255, 0.06), transparent 62%),
                var(--bg-primary);
            overflow: hidden;
            position: relative;
        }
        [data-theme="light"] #app {
            background:
                radial-gradient(900px 420px at 12% -12%, rgba(45, 106, 255, 0.06), transparent 62%),
                radial-gradient(800px 420px at 88% 112%, rgba(109, 92, 255, 0.05), transparent 62%),
                var(--bg-primary);
        }

        /* ===== 遮罩层（仅移动端） ===== */
        #sidebarOverlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 9;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        #sidebarOverlay.show {
            display: block;
            opacity: 1;
        }

        /* ===== 侧边栏 ===== */
        .sidebar {
            width: var(--sidebar-width);
            background:
                linear-gradient(180deg, color-mix(in srgb, var(--bg-secondary) 96%, var(--accent) 4%), var(--bg-secondary) 40%);
            border-right: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            height: 100%;
            flex-shrink: 0;
            transition: width 0.25s ease, margin 0.25s ease, opacity 0.2s ease, transform 0.25s ease;
            overflow: hidden;
            position: relative;
            z-index: 10;
        }

        .sidebar.push-mode {
            position: relative;
        }
        .sidebar.push-mode.collapsed {
            width: 0;
            border-right: none;
            margin-right: 0;
            opacity: 0;
            pointer-events: none;
        }

        .sidebar.overlay-mode {
            position: fixed;
            top: 0;
            left: 0;
            height: 100%;
            width: var(--sidebar-width);
            transform: translateX(-100%);
            box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
            z-index: 10;
            border-right: 1px solid var(--border-color);
        }
        .sidebar.overlay-mode:not(.collapsed) {
            transform: translateX(0);
        }
        .sidebar.overlay-mode.collapsed {
            transform: translateX(-100%);
            opacity: 1;
            pointer-events: none;
        }

        .sidebar-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 14px 12px;
            border-bottom: 1px solid var(--border-color);
            flex-shrink: 0;
            background: linear-gradient(180deg, color-mix(in srgb, var(--bg-secondary) 98%, var(--accent) 6%), transparent);
        }
        .sidebar.overlay-mode .sidebar-header {
            padding-left: 64px;
        }
        .sidebar-header .brand {
            font-weight: 700;
            font-size: 17px;
            font-family: var(--font-display);
            color: var(--text-primary);
            letter-spacing: -0.3px;
            display: flex;
            align-items: center;
            gap: 8px;
            white-space: nowrap;
            overflow: hidden;
        }
        .sidebar-header .brand svg {
            color: var(--accent);
            flex-shrink: 0;
            filter: drop-shadow(0 0 6px var(--accent-glow));
        }
        .sidebar-header .new-btn {
            background: var(--accent-gradient);
            border: none;
            color: #fff;
            width: 40px;
            height: 40px;
            border-radius: 10px;
            cursor: pointer;
            font-size: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
            box-shadow: 0 2px 10px var(--accent-glow);
        }
        .sidebar-header .new-btn:hover {
            transform: scale(1.05);
            filter: brightness(1.08);
            box-shadow: 0 4px 16px var(--accent-glow);
        }
        .sidebar-header .new-btn:active {
            transform: scale(0.97);
        }

        .sidebar-list {
            flex: 1;
            overflow-y: auto;
            padding: 8px 10px;
        }
        .sidebar-list .empty-tip {
            padding: 20px 10px;
            color: var(--text-muted);
            font-size: 15px;
            text-align: center;
            white-space: nowrap;
            overflow: hidden;
        }
        .sidebar-list .convo-item {
            display: flex;
            align-items: center;
            padding: 8px 10px;
            border-radius: 10px;
            cursor: pointer;
            margin-bottom: 2px;
            gap: 6px;
            color: var(--text-secondary);
            transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
            position: relative;
            border: 1px solid transparent;
        }
        .sidebar-list .convo-item:hover {
            background: color-mix(in srgb, var(--bg-hover) 70%, transparent);
            transform: translateX(2px);
        }
        .sidebar-list .convo-item.active {
            background: color-mix(in srgb, var(--accent) 12%, var(--bg-card));
            border-color: color-mix(in srgb, var(--accent) 45%, transparent);
            color: var(--text-primary);
            box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm);
        }
        .sidebar-list .convo-item .title {
            flex: 1;
            font-size: 15px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-weight: 500;
        }
        .sidebar-list .convo-item .actions {
            display: flex;
            gap: 4px;
            opacity: 0;
            transition: opacity 0.2s;
        }
        .sidebar-list .convo-item:hover .actions {
            opacity: 1;
        }
        .sidebar-list .convo-item .actions button {
            background: transparent;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 15px;
            padding: 2px 4px;
            border-radius: 4px;
            line-height: 1;
        }
        .sidebar-list .convo-item .actions button:hover {
            background: var(--bg-hover);
            color: var(--text-primary);
        }
        .sidebar-list .convo-item .actions .delete-btn:hover {
            color: #f87171;
        }

        .sidebar-footer {
            padding: 12px 14px;
            border-top: 1px solid var(--border-color);
            font-size: 13px;
            color: var(--text-muted);
            flex-shrink: 0;
            text-align: center;
            line-height: 1.5;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        .sidebar-footer span {
            white-space: nowrap;
            overflow: hidden;
            width: 100%;
        }
        .sidebar-footer .storage-hint {
            font-size: 12px;
            opacity: 0.7;
            margin-top: 2px;
        }
        .sidebar-footer .storage-hint.warn {
            color: #fbbf24;
            opacity: 1;
        }

        /* 侧边栏切换按钮（汉堡菜单） */
        .toggle-sidebar-btn {
            position: fixed;
            left: 16px;
            top: 12px;
            z-index: 20;
            background: color-mix(in srgb, var(--bg-card) 88%, transparent);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            width: 40px;
            height: 40px;
            border-radius: 10px;
            cursor: pointer;
            font-size: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: left 0.25s ease, transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
            box-shadow: var(--shadow-sm);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
        }
        .toggle-sidebar-btn:hover {
            background: var(--bg-hover);
            transform: translateY(-1px);
            box-shadow: var(--shadow);
        }
        .toggle-sidebar-btn:active {
            transform: translateY(0);
        }

        .sidebar.push-mode:not(.collapsed) ~ .toggle-sidebar-btn {
            left: calc(var(--sidebar-width) + 16px);
        }
        .sidebar.overlay-mode ~ .toggle-sidebar-btn {
            left: 16px;
        }

        /* ===== 主聊天区域 ===== */
        .main-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            height: 100%;
            min-width: 0;
            background: var(--bg-primary);
            position: relative;
            transition: margin-left 0.25s ease;
        }

        .sidebar.push-mode:not(.collapsed) ~ .main-area {
            margin-left: 0;
        }
        .sidebar.overlay-mode ~ .main-area {
            margin-left: 0;
        }

        /* ===== 顶部导航栏 ===== */
        .navbar {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            padding: 12px 20px;
            border-bottom: 1px solid var(--border-color);
            background: color-mix(in srgb, var(--bg-primary) 88%, var(--bg-card));
            backdrop-filter: blur(14px);
            -webkit-backdrop-filter: blur(14px);
            gap: 8px;
            position: relative;
            z-index: 5;
            box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 4px 18px rgba(0, 0, 0, 0.04);
        }
        .navbar .title-display {
            grid-column: 2;
            text-align: center;
            font-weight: 600;
            font-size: 18px;
            font-family: var(--font-display);
            letter-spacing: -0.01em;
            color: var(--text-primary);
            max-width: 300px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            justify-self: center;
        }
        .navbar-actions {
            grid-column: 3;
            justify-self: end;
            display: flex;
            gap: 6px;
            align-items: center;
        }
        .navbar-actions button {
            background: color-mix(in srgb, var(--bg-card) 85%, transparent);
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            width: 40px;
            height: 40px;
            border-radius: 10px;
            cursor: pointer;
            font-size: 18px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: 0.15s;
            box-shadow: var(--shadow-sm);
        }
        .navbar-actions button:hover {
            background: var(--bg-hover);
            color: var(--text-primary);
            transform: translateY(-1px);
            box-shadow: var(--shadow);
        }
        .navbar-actions button:active {
            transform: translateY(0);
        }

        /* ===== 消息列表 ===== */
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
            padding: 20px 0 12px;
            scroll-behavior: smooth;
            position: relative;
        }

        .chat-inner {
            width: 100%;
            max-width: 980px;
            padding: 0 20px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            gap: 18px;
        }

        .message,
        .empty-state {
            width: 100%;
        }

        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            color: var(--text-muted);
            text-align: center;
            border: none !important;
            background: transparent !important;
            box-shadow: none !important;
            backdrop-filter: none !important;
        }
        .empty-state .icon {
            font-size: 52px;
            margin-bottom: 16px;
            opacity: 0.5;
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
        }
        .empty-state h2 {
            font-family: 'Space Grotesk', var(--font);
            font-size: 38px;
            font-weight: 700;
            letter-spacing: -0.02em;
            color: var(--text-secondary);
            margin-bottom: 8px;
        }
        .empty-state h2 .brand-accent {
            color: var(--accent);
        }
        @supports ((-webkit-background-clip: text) or (background-clip: text)) {
            .empty-state h2 .brand-accent {
                background: var(--accent-gradient);
                -webkit-background-clip: text;
                background-clip: text;
                color: transparent;
                filter: drop-shadow(0 0 14px var(--accent-glow));
            }
        }

        /* ===== 空界面：标题与输入框整体垂直居中（略偏上） ===== */
        .main-area.empty-mode .chat-messages {
            flex: 0 0 auto;
            margin-top: auto;
            overflow: visible;
            padding: 0;
            transform: translateY(-28px);
        }
        .main-area.empty-mode .chat-inner {
            padding: 0 20px;
        }
        .main-area.empty-mode .empty-state {
            height: auto;
            padding-top: 0;
            padding-bottom: 18px;
        }
        .main-area.empty-mode .empty-state h2 {
            margin-bottom: 0;
        }
        .main-area.empty-mode .input-area {
            margin-top: 0;
            margin-bottom: auto;
            transform: translateY(-28px);
        }
        .main-area.empty-mode .title-display {
            display: none;
        }
        .main-area.empty-mode .app-footer {
            display: none;
        }

        /* ===== 页面底部提示 ===== */
        .app-footer {
            flex-shrink: 0;
            text-align: center;
            padding: 4px 16px 8px;
            font-size: 12px;
            line-height: 1.5;
            color: var(--text-muted);
            user-select: none;
        }
