:root {
    --primary-green: #7fda55;
    --primary-green-dark: #5cb536;
    --text-dark: #1a1a1a;
    --text-gray: #666666;
    --text-light: #999999;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --bg-chat: #f5f5f5;
    --bg-code: #1e1e1e;
    --border-dark: #1a1a1a;
    --border-light: #e0e0e0;
    --accent-blue: #4a90d9;
    --accent-red: #e74c3c;
    --accent-orange: #f39c12;
    --shadow-card: 4px 4px 0 #1a1a1a;
    --shadow-card-hover: 6px 6px 0 #1a1a1a;
    --shadow-button: 3px 3px 0 #1a1a1a;
    --shadow-button-hover: 4px 4px 0 #1a1a1a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.7;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

button, .model-trigger, .dropdown-item, .toolbar-btn, .msg-action-btn {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.chat-area::-webkit-scrollbar,
.preset-form-body::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-track,
.preset-form-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-area::-webkit-scrollbar-thumb,
.preset-form-body::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

.chat-area::-webkit-scrollbar-thumb:hover,
.preset-form-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.chat-area,
.preset-form-body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.assistant-sidebar {
    position: absolute;
    left: 0;
    top: 64px;
    bottom: 0;
    width: 280px;
    background: var(--bg-white);
    border-right: 2px solid var(--border-dark);
    box-shadow: var(--shadow-card);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 150;
    display: flex;
    flex-direction: column;
}

.assistant-sidebar.active {
    transform: translateX(0);
}

.assistant-header {
    padding: 1rem;
    border-bottom: 2px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-shrink: 0;
}

.assistant-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.assistant-count-badge { color: var(--primary-green); font-weight: 700; }

.assistant-toggle-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--border-dark);
}

.assistant-search {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-light);
}

.assistant-search-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    font-size: 0.9rem;
    color: var(--text-dark);
    box-shadow: 2px 2px 0 var(--border-dark);
}

.assistant-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.assistant-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    border: 1px solid var(--border-light);
    transition: background 0.2s ease;
    background: var(--bg-light);
    position: relative;
}

.assistant-item:hover {
    background: var(--bg-white);
    border-color: var(--border-dark);
}

.assistant-item.active {
    background: var(--bg-white);
    border-color: var(--border-dark);
    box-shadow: 2px 2px 0 var(--border-dark);
}

.assistant-item i {
    color: var(--primary-green);
    width: 22px;
    text-align: center;
}

.assistant-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
}

.assistant-item-desc {
    font-size: 0.75rem;
    color: var(--text-light);
}

.hot-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    background: #e53935;
    color: #fff;
    font-weight: 700;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 12px;
    box-shadow: 1px 1px 0 var(--border-dark);
    animation: hotPulse 1.2s infinite;
}

@keyframes hotPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.85; }
    100% { transform: scale(1); opacity: 1; }
}

/* 分类菜单 */
.assistant-category { border: 2px solid var(--border-dark); background: var(--bg-white); box-shadow: 2px 2px 0 var(--border-dark); }
.category-header { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0.8rem; cursor: pointer; border-bottom: 2px solid var(--border-dark); }
.category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}
.category-header .category-title i {
    color: var(--primary-green);
    width: 20px;
    height: 20px;
    font-size: 16px;
    line-height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.category-header .category-title span {
    line-height: 20px;
    display: inline-block;
}
.category-header > i { color: var(--primary-green); }
.category-meta { display: flex; align-items: center; gap: 8px; min-width: 64px; justify-content: flex-end; }
.category-count { width: 28px; text-align: right; font-weight: 700; color: var(--primary-green); }
.category-body { display: none; padding: 0.6rem; }
.assistant-category.open .category-body { display: block; }

.preset-chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.3rem;
}

.preset-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    border: 2px solid var(--border-dark);
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--border-dark);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.preset-chip:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--border-dark);
    background: var(--bg-light);
}

.assistant-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border: 2px solid var(--border-dark);
    background: var(--bg-white);
    color: var(--text-dark);
    font-size: 0.9rem;
    box-shadow: 2px 2px 0 var(--border-dark);
}

.top-bar {
    padding: 1rem 2rem;
    background: var(--bg-white);
    border-bottom: 2px solid var(--border-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
}

.top-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.model-dropdown {
    position: relative;
}

.model-trigger {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1.2rem;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-button);
}

.model-trigger:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-button-hover);
}

.model-trigger i.chevron {
    transition: transform 0.3s ease;
    margin-left: 0.5rem;
}

.model-dropdown.active .model-trigger i.chevron {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    min-width: 280px;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    box-shadow: var(--shadow-card);
    z-index: 200;
    display: none;
}

.dropdown-menu.right-align {
    left: auto;
    right: 0;
}

#historyDropdown .dropdown-menu { min-width: 320px; max-height: 600px; overflow-y: auto; }
#changelogDropdown .dropdown-menu { min-width: 320px; max-height: 600px; overflow-y: auto; }

.model-dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s ease;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--bg-light);
}

.dropdown-item.selected,
.dropdown-item.active {
    background: var(--bg-light);
}

.dropdown-item i {
    color: var(--primary-green);
    font-size: 1.1rem;
    width: 24px;
}

.dropdown-item.active i {
    color: var(--text-dark);
}

.dropdown-item-info {
    flex: 1;
}

.history-delete-icon { margin-left: 8px; cursor: pointer; color: var(--accent-red); }
.dropdown-item i.history-delete-icon { color: var(--accent-red) !important; }
.history-delete-icon:hover { opacity: 0.8; }

.dropdown-item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
}

.dropdown-item-desc {
    font-size: 0.8rem;
    color: var(--text-light);
}

.top-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.main-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.main-title i {
    color: var(--primary-green);
}

.top-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.top-action-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 0 var(--border-dark);
    flex: 0 0 auto;
}

.top-action-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0 var(--border-dark);
    background: var(--bg-light);
}

.mode-dropdown {
    position: relative;
}

.mode-dropdown.active .dropdown-menu {
    display: block;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    border: 2px solid var(--border-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 0 var(--border-dark);
    position: relative;
}

.user-avatar:hover {
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0 var(--border-dark);
}

.user-avatar.pro {
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-dark));
    color: var(--text-dark);
    border: 2px solid var(--border-dark);
    box-shadow: 2px 2px 0 var(--border-dark);
}

.avatar-text {
    font-weight: 700;
    font-size: 1.1rem;
}

.pro-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    border-radius: 10px;
    padding: 0 6px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-dark);
    box-shadow: 2px 2px 0 var(--border-dark);
}

/* 验证弹窗基础样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-overlay.show { display: flex; }

.modal-content {
    background: #fff;
    border: 2px solid var(--border-dark);
    border-radius: 15px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 2px solid var(--border-dark);
}

.modal-body { padding: 1.25rem; }

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-dark);
}

.auth-status { margin-top: 1rem; }
.status-message { padding: 0.75rem 1rem; border-radius: 8px; }
.status-success { background: #e6ffed; color: #0d8f4b; border: 2px solid #b7f5c7; }
.status-error { background: #ffe6e6; color: #b00020; border: 2px solid #ffb3b3; }
.status-loading { background: #f0f4ff; color: #3b5bfd; border: 2px solid #c7d2ff; }

/* 验证弹窗图片布局与尺寸限制 */
.auth-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.auth-left {
    flex: 1;
    min-width: 0;
}
.auth-visual {
    flex: 0 0 280px;
    max-width: 280px;
    max-height: 320px;
    overflow: hidden;
}
.auth-visual img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}
@media (max-width: 520px) {
    .auth-content { flex-direction: column; }
    .auth-visual { max-width: 100%; max-height: 180px; }
}

/* 顶部登录/退出按钮 */
.login-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 12px;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 0 var(--border-dark);
    text-decoration: none;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
    line-height: 1;
}

.login-btn:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--border-dark); }

.auth-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-white);
    color: var(--text-dark);
    border: 2px solid var(--border-dark);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--border-dark);
    transition: all 0.2s ease;
}

.auth-start-btn:hover {
    background: var(--bg-light);
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0 var(--border-dark);
}

.auth-start-btn i { color: var(--primary-green); }

.auth-start-btn.danger {
    background: #ffecec;
    color: #b00020;
    border-color: var(--border-dark);
}

.auth-start-btn.danger:hover {
    background: #ffdede;
}

/* 代码预览浮窗 */
.code-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 1rem;
}
.code-preview-overlay.show { display: flex; }
.code-preview-content {
    background: #fff;
    border: 2px solid var(--border-dark);
    border-radius: 16px;
    width: 90vw;
    height: 90vh;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.code-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 2px solid var(--border-dark);
}
.code-preview-title { font-weight: 700; color: var(--text-dark); }
.code-preview-tools { display: flex; gap: 0.5rem; }
.code-preview-tools { position: relative; }
.code-preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: var(--bg-white);
    color: var(--text-dark);
    border: 2px solid var(--border-dark);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--border-dark);
}
.code-preview-btn:hover { background: var(--bg-light); }
.code-download-menu { position: absolute; right: 6px; top: calc(100% + 8px); background: var(--bg-white); border: 2px solid var(--border-dark); border-radius: 12px; box-shadow: 2px 2px 0 var(--border-dark); padding: 6px; z-index: 1200; min-width: 160px; }
.code-download-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.75rem; border-radius: 8px; cursor: pointer; color: var(--text-dark); }
.code-download-item:hover { background: var(--bg-light); }
.code-preview-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px; border-bottom: 2px solid var(--border-dark); background: var(--bg-white); }
.code-preview-toggle { border-top: 0; }
.code-preview-toggle { padding-left: 1rem; }
.code-preview-toggle .toggle-btn { width: 38px; height: 38px; background: var(--bg-light); border: 2px solid var(--border-dark); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 2px 2px 0 var(--border-dark); color: var(--text-dark); }
.code-preview-toggle .toggle-btn.active { background: var(--bg-white); }
.code-preview-body {
    flex: 1;
    position: relative;
    background: var(--bg-white);
}
.code-preview-body .pane {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    display: none;
    padding: 1rem;
}
.code-preview-body .pane.active { display: block; }
.code-preview-iframe { width: 100%; height: 100%; border: none; background: #fff; }
.code-pane pre { white-space: pre; overflow: auto; border: 1px solid var(--border-light); border-radius: 8px; padding: 12px; background: #f9f9f9; }
.preview-pane { padding: 1.5rem 1.5rem 1.5rem 2rem; }
.preview-pane pre { white-space: pre-wrap; word-break: break-word; border: 1px solid var(--border-light); border-radius: 8px; padding: 12px; background: #f9f9f9; }
.markdown-body { font-size: 0.95rem; line-height: 1.7; color: var(--text-dark); }
.markdown-body h1 { font-size: 1.35rem; margin: 0.6rem 0; }
.markdown-body h2 { font-size: 1.2rem; margin: 0.6rem 0; }
.markdown-body h3 { font-size: 1.05rem; margin: 0.5rem 0; }
.markdown-body p { margin: 0.5rem 0; }
.markdown-body ul, .markdown-body ol { margin: 0.5rem 0 0.5rem 1.25rem; }
.markdown-body code { background: #f4f4f4; padding: 0 4px; border-radius: 4px; }

/* 折叠代码卡片样式 */
.code-card {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    border-radius: 14px;
    padding: 0.8rem 1rem;
    box-shadow: 2px 2px 0 var(--border-dark);
    margin: 0.5rem 0;
}
.code-card-left { width: 48px; display: flex; align-items: center; justify-content: center; }
.code-card-icon { width: 36px; height: 54px; border: 2px solid var(--border-dark); border-radius: 12px; background: var(--bg-light); display: flex; align-items: center; justify-content: center; color: var(--text-gray); box-shadow: 2px 2px 0 var(--border-dark); transform: rotate(-6deg); }
.code-card-main { flex: 1; }
.code-card-title { font-weight: 700; color: var(--text-dark); }
.code-card-meta { color: var(--text-gray); font-size: 0.9rem; margin-top: 2px; }
.code-card-actions { display: flex; align-items: center; }
.code-card .code-preview-btn { padding: 0.35rem 0.8rem; font-size: 0.9rem; }

/* 状态卡片动态效果 */
.code-status-card { position: relative; overflow: hidden; }
.code-status-card::after {
    content: "";
    position: absolute;
    left: -40%;
    top: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0) 100%);
    animation: shimmerSweep 2.2s ease-in-out infinite;
}
@keyframes shimmerSweep {
    0% { left: -40%; }
    50% { left: 70%; }
    100% { left: 110%; }
}
.code-status-card .code-card-icon { animation: wobble 1.8s ease-in-out infinite; }
@keyframes wobble {
    0%, 100% { transform: rotate(-6deg) translateY(0); }
    25% { transform: rotate(-3deg) translateY(-0.5px); }
    50% { transform: rotate(-6deg) translateY(0.5px); }
    75% { transform: rotate(-9deg) translateY(-0.3px); }
}

.user-info-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; }
.user-info-label { min-width: 80px; font-weight: 700; color: var(--text-dark); }
.user-info-value { flex: 1; color: var(--text-dark); }

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-chat);
    position: relative;
}

.ai-icon-section {
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    background: var(--bg-chat);
}

.ai-orb-container {
    width: 80px;
    height: 80px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orb-default {
    width: 55px;
    height: 55px;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    border: 3px solid var(--border-dark);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    box-shadow: var(--shadow-card);
    animation: morphing 8s ease-in-out infinite;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

@keyframes morphing {
    0%, 100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: rotate(0deg);
    }
    25% {
        border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
        transform: rotate(5deg);
    }
    50% {
        border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
        transform: rotate(0deg);
    }
    75% {
        border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
        transform: rotate(-5deg);
    }
}

.orb-circles {
    position: absolute;
    width: 80px;
    height: 80px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.orb-circle {
    position: absolute;
    background: var(--primary-green);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform-origin: center center;
    border: 2px solid var(--border-dark);
    box-shadow: 2px 2px 0 var(--border-dark);
}

.orb-circle.large {
    width: 16px;
    height: 16px;
}

.orb-circle.small {
    width: 8px;
    height: 8px;
    border-width: 1.5px;
    box-shadow: 1px 1px 0 var(--border-dark);
}

.orb-circle:nth-child(1) { transform: translate(-50%, -50%) rotate(0deg) translateY(-32px); }
.orb-circle:nth-child(2) { transform: translate(-50%, -50%) rotate(22.5deg) translateY(-32px); }
.orb-circle:nth-child(3) { transform: translate(-50%, -50%) rotate(45deg) translateY(-32px); }
.orb-circle:nth-child(4) { transform: translate(-50%, -50%) rotate(67.5deg) translateY(-32px); }
.orb-circle:nth-child(5) { transform: translate(-50%, -50%) rotate(90deg) translateY(-32px); }
.orb-circle:nth-child(6) { transform: translate(-50%, -50%) rotate(112.5deg) translateY(-32px); }
.orb-circle:nth-child(7) { transform: translate(-50%, -50%) rotate(135deg) translateY(-32px); }
.orb-circle:nth-child(8) { transform: translate(-50%, -50%) rotate(157.5deg) translateY(-32px); }
.orb-circle:nth-child(9) { transform: translate(-50%, -50%) rotate(180deg) translateY(-32px); }
.orb-circle:nth-child(10) { transform: translate(-50%, -50%) rotate(202.5deg) translateY(-32px); }
.orb-circle:nth-child(11) { transform: translate(-50%, -50%) rotate(225deg) translateY(-32px); }
.orb-circle:nth-child(12) { transform: translate(-50%, -50%) rotate(247.5deg) translateY(-32px); }
.orb-circle:nth-child(13) { transform: translate(-50%, -50%) rotate(270deg) translateY(-32px); }
.orb-circle:nth-child(14) { transform: translate(-50%, -50%) rotate(292.5deg) translateY(-32px); }
.orb-circle:nth-child(15) { transform: translate(-50%, -50%) rotate(315deg) translateY(-32px); }
.orb-circle:nth-child(16) { transform: translate(-50%, -50%) rotate(337.5deg) translateY(-32px); }

.ai-icon-section.thinking .orb-default {
    opacity: 0;
    transform: scale(0.5);
}

.ai-icon-section.thinking .orb-circles {
    opacity: 1;
    animation: thinking-rotate 4s linear infinite;
}

@keyframes thinking-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ai-icon-section.outputting .orb-default {
    opacity: 0;
    transform: scale(0.5);
}

.ai-icon-section.outputting .orb-circles {
    opacity: 1;
    animation: output-rotate 6s linear infinite;
}

@keyframes output-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ai-icon-section.outputting .orb-circle.large {
    animation: swap-large 1.5s ease-in-out infinite;
}

.ai-icon-section.outputting .orb-circle.small {
    animation: swap-small 1.5s ease-in-out infinite;
}

.ai-icon-section.outputting .orb-circle:nth-child(1) { animation-delay: 0s; }
.ai-icon-section.outputting .orb-circle:nth-child(2) { animation-delay: 0s; }
.ai-icon-section.outputting .orb-circle:nth-child(3) { animation-delay: 0.1875s; }
.ai-icon-section.outputting .orb-circle:nth-child(4) { animation-delay: 0.1875s; }
.ai-icon-section.outputting .orb-circle:nth-child(5) { animation-delay: 0.375s; }
.ai-icon-section.outputting .orb-circle:nth-child(6) { animation-delay: 0.375s; }
.ai-icon-section.outputting .orb-circle:nth-child(7) { animation-delay: 0.5625s; }
.ai-icon-section.outputting .orb-circle:nth-child(8) { animation-delay: 0.5625s; }
.ai-icon-section.outputting .orb-circle:nth-child(9) { animation-delay: 0.75s; }
.ai-icon-section.outputting .orb-circle:nth-child(10) { animation-delay: 0.75s; }
.ai-icon-section.outputting .orb-circle:nth-child(11) { animation-delay: 0.9375s; }
.ai-icon-section.outputting .orb-circle:nth-child(12) { animation-delay: 0.9375s; }
.ai-icon-section.outputting .orb-circle:nth-child(13) { animation-delay: 1.125s; }
.ai-icon-section.outputting .orb-circle:nth-child(14) { animation-delay: 1.125s; }
.ai-icon-section.outputting .orb-circle:nth-child(15) { animation-delay: 1.3125s; }
.ai-icon-section.outputting .orb-circle:nth-child(16) { animation-delay: 1.3125s; }

@keyframes swap-large {
    0%, 100% { 
        width: 16px; 
        height: 16px;
        border-width: 2px;
        box-shadow: 2px 2px 0 var(--border-dark);
    }
    50% { 
        width: 8px; 
        height: 8px;
        border-width: 1.5px;
        box-shadow: 1px 1px 0 var(--border-dark);
    }
}

@keyframes swap-small {
    0%, 100% { 
        width: 8px; 
        height: 8px;
        border-width: 1.5px;
        box-shadow: 1px 1px 0 var(--border-dark);
    }
    50% { 
        width: 16px; 
        height: 16px;
        border-width: 2px;
        box-shadow: 2px 2px 0 var(--border-dark);
    }
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 2rem 2rem;
    background: var(--bg-chat);
}

.chat-container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
}

.welcome-message h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.welcome-message p {
    font-size: 1rem;
    color: var(--text-gray);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.8;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message-user {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

.message-user .message-content {
    max-width: 70%;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    padding: 1rem 1.2rem;
    box-shadow: var(--shadow-card);
    position: relative;
}

.message-user .message-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-dark);
}

.message-user .message-actions {
    position: absolute;
    bottom: -35px;
    right: 0;
    display: flex;
    gap: 0.3rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message-user:hover .message-actions {
    opacity: 1;
}

.message-ai {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.message-ai .ai-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-green);
    border: 2px solid var(--border-dark);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    box-shadow: 2px 2px 0 var(--border-dark);
    flex-shrink: 0;
}

.message-ai .message-content {
    flex: 1;
    max-width: 75%;
    position: relative;
}

.message-ai .message-text {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-dark);
}

.message-ai .message-text p {
    margin-bottom: 1rem;
}

.message-ai .message-text p:last-child {
    margin-bottom: 0;
}

.message-ai .message-text code {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    padding: 0.2rem 0.4rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
}

.message-ai .message-text pre {
    background: var(--bg-code);
    border: 2px solid var(--border-dark);
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
    box-shadow: 3px 3px 0 var(--border-dark);
}

.message-ai .message-text pre code {
    background: none;
    border: none;
    padding: 0;
    color: #d4d4d4;
}

/* 表格渲染优化：显示边框与表头背景 */
.message-ai .message-text table,
.message-user .message-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
.message-ai .message-text th,
.message-ai .message-text td,
.message-user .message-text th,
.message-user .message-text td {
    border: 1px solid var(--border-light);
    padding: 8px;
    vertical-align: top;
}
.message-ai .message-text thead th,
.message-user .message-text thead th {
    background: var(--bg-light);
    font-weight: 700;
}
.message-ai .message-text tbody tr:nth-child(even),
.message-user .message-text tbody tr:nth-child(even) {
    background: #fafafa;
}

/* 附件上传进度环（对话框与预设表单通用） */
.upload-progress-ring {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: conic-gradient(var(--primary-green) var(--angle), #eaeaea 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
}
.upload-progress-ring::after {
    content: '';
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
}
.upload-progress-ring .progress-text {
    position: absolute;
    font-size: 10px;
    color: #333;
}
.upload-done-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e0e0e0;
    color: var(--primary-green);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.04);
}
.upload-ring-inline {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: conic-gradient(var(--primary-green) var(--angle), #eaeaea 0deg);
    vertical-align: middle;
    margin-right: 6px;
    position: relative;
}
.upload-ring-inline::after { content: ''; position: absolute; top: 3px; left: 3px; width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.upload-check-inline { display: inline-flex; width: 16px; height: 16px; border: 1px solid #e0e0e0; border-radius: 50%; align-items: center; justify-content: center; color: var(--primary-green); font-size: 10px; margin-right: 6px; }

.message-ai .message-actions {
    margin-top: 0.8rem;
    display: flex;
    gap: 0.3rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message-ai:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    width: 32px;
    height: 32px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.2s ease;
}

.msg-action-btn:hover {
    border-color: var(--border-dark);
    color: var(--text-dark);
    background: var(--bg-light);
}

.msg-action-btn.copied {
    background: var(--primary-green);
    color: var(--text-dark);
    border-color: var(--border-dark);
}

.typing-cursor::after {
    content: '▋';
    animation: blink 1s step-end infinite;
    color: var(--primary-green);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.input-area {
    padding: 1.5rem 2rem;
    background: var(--bg-chat);
    flex-shrink: 0;
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
}

.main-input-wrapper {
    display: flex;
    gap: 0.8rem;
    align-items: flex-end;
}

.input-box {
    flex: 1;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
}

.input-box textarea {
    width: 100%;
    padding: 1rem;
    border: none;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    min-height: 50px;
    max-height: 200px;
    outline: none;
    background: transparent;
}

.input-box textarea::placeholder {
    color: var(--text-light);
}

.input-toolbar {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-light);
    position: relative;
}

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

.send-hint {
    font-size: 0.78rem;
    color: var(--text-gray);
    margin-left: -2ch;
}

.toolbar-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--text-gray);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-round { border-radius: 50%; }

.toolbar-btn:hover {
    border-color: var(--border-dark);
    color: var(--text-dark);
}

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

.mode-toggle-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-light);
    border: 1px solid #e3e3e3;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    color: var(--text-gray);
    transition: all 0.2s ease;
}
.mode-toggle-btn i { font-size: 0.95rem; }
.mode-toggle-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.mode-toggle-btn:hover { border-color: #d0d0d0; box-shadow: 0 3px 8px rgba(0,0,0,0.08); }
.mode-toggle-btn.active {
    background: #eceff3;
    border-color: #c7cbd1;
    color: var(--primary-green);
    box-shadow: 0 3px 10px rgba(0,0,0,0.10);
}

.toolbar-float {
    position: fixed;
    min-width: 160px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-radius: 12px;
    display: none;
    z-index: 1200;
    backdrop-filter: saturate(120%) blur(4px);
}

#uploadMenu,
#featuresMenu {
    border: 2px solid var(--border-dark);
    box-shadow: 2px 2px 0 var(--border-dark);
}

#featuresMenu .float-item {
    justify-content: space-between;
}

#featuresMenu .float-item span {
    margin-right: 0 !important;
}

.toolbar-float.show { display: block; }

.float-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-dark);
    cursor: pointer;
    background: var(--bg-white);
}

.float-item:last-child { border-bottom: none; }

.float-item i { color: var(--text-dark); font-size: 0.85rem; min-width: 18px; text-align: center; }
.float-item span { font-size: 0.78rem; line-height: 1.15; }

.float-item:hover { background: var(--bg-light); }

.message-content .upload-preview { margin-top: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.upload-image { max-width: 160px; max-height: 120px; border: 2px solid var(--border-dark); box-shadow: 2px 2px 0 var(--border-dark); }
.upload-file-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.6rem; border: 2px solid var(--border-dark); background: var(--bg-white); box-shadow: 2px 2px 0 var(--border-dark); border-radius: 12px; }

.search-sources { margin-top: 0.5rem; display: flex; gap: 0.4rem; flex-wrap: wrap; }
.search-sources a { display: inline-flex; align-items: center; padding: 0.35rem 0.6rem; border: 2px solid var(--border-dark); background: var(--bg-white); box-shadow: 2px 2px 0 var(--border-dark); color: var(--text-dark); font-size: 0.78rem; text-decoration: none; }
.search-sources a:hover { background: var(--bg-light); }

.assistant-inline-name {
    display: inline-block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dark);
    letter-spacing: 0.02em;
}

.char-count {
    font-size: 0.8rem;
    color: var(--text-light);
}

.send-btn, #sendBtn {
    width: 33.33px;
    height: 33.33px;
    background: var(--primary-green);
    border: 2px solid var(--border-dark);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-button);
}

.send-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-button-hover);
}

.send-btn.send-btn-mini {
    width: 21.33px;
    height: 21.33px;
    font-size: 0.67rem;
    box-shadow: 2px 2px 0 var(--border-dark);
    border-radius: 10px;
}

.preset-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-chat);
    z-index: 50;
    display: none;
    flex-direction: column;
    padding: 2rem;
}

.preset-overlay.active {
    display: flex;
}

.preset-form {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.preset-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 2px solid var(--border-dark);
    flex-shrink: 0;
}

.preset-form-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preset-form-header h3 i {
    color: var(--primary-green);
}

.preset-close-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 0 var(--border-dark);
}

.preset-close-btn:hover {
    background: var(--accent-red);
    color: white;
}

.preset-form-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
    margin-bottom: 0.75rem;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.form-label i {
    color: var(--text-light);
    font-size: 0.8rem;
}

.form-input,
.form-select,
.form-textarea {
    padding: 0.7rem 1rem;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    font-size: 0.95rem;
    color: var(--text-dark);
    font-family: inherit;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 0 var(--border-dark);
}

.form-input,
.form-textarea {
    margin-bottom: 0.5rem;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--border-dark);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a1a1a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.preset-form-footer {
    padding: 1.2rem 1.5rem;
    border-top: 2px solid var(--border-dark);
    background: var(--bg-light);
    flex-shrink: 0;
}

.preset-submit-btn {
    width: 100%;
    padding: 0.9rem;
    background: var(--primary-green);
    border: 2px solid var(--border-dark);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-button);
}

.preset-submit-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-button-hover);
}

.toast {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.8rem 1.5rem;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast i {
    color: var(--primary-green);
}

@media (max-width: 1024px) and (min-width: 769px) {
    .top-bar {
        padding: 1rem 1.5rem;
        margin-top: 8px;
        margin-top: max(env(safe-area-inset-top), 8px);
    }
    .chat-area {
        padding: 0 1.5rem 1.5rem;
    }
    .input-area {
        padding: 1.5rem;
    }
    .chat-container,
    .input-container {
        max-width: 700px;
    }
    .message-user .message-content {
        max-width: 75%;
    }
    .message-ai .message-content {
        max-width: 80%;
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 0.8rem 1rem;
        margin-top: 8px;
        margin-top: max(env(safe-area-inset-top), 8px);
        flex-wrap: wrap;
    }
    .top-left {
        order: 2;
        width: 100%;
        margin-top: 0.8rem;
    }
    .top-center {
        position: static;
        transform: none;
        order: 1;
        flex: 1;
    }
    .main-title {
        font-size: 1.1rem;
        gap: 0.4rem;
    }
    .main-title i {
        font-size: 1rem;
    }
    .top-right {
        order: 1;
        gap: 0.5rem;
    }
    .top-action-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    .model-dropdown {
        width: 100%;
    }
    .model-trigger {
        width: 100%;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        justify-content: space-between;
    }
    .dropdown-menu {
        width: 100%;
        min-width: auto;
    }
    .mode-dropdown .dropdown-menu {
        position: fixed;
        right: 12px;
        left: auto;
        top: 60px;
        width: 220px;
        min-width: 220px;
    }
    #changelogDropdown .dropdown-menu {
        position: absolute;
        left: 0;
        right: auto;
        top: calc(100% + 6px);
        width: auto;
        min-width: 240px;
        z-index: 250;
    }
    .mode-dropdown .dropdown-item-desc {
        display: none;
    }
    #changelogDropdown .dropdown-item-desc {
        display: block;
        font-size: 0.78rem;
    }
    .assistant-inline-name {
        max-width: 140px;
        font-size: 0.75rem;
    }
    .mode-dropdown .dropdown-item {
        padding: 0.6rem 0.8rem;
    }
    .dropdown-item {
        padding: 0.7rem 1rem;
    }
    .dropdown-item-name {
        font-size: 0.9rem;
    }
    .dropdown-item-desc {
        font-size: 0.75rem;
    }
    .ai-icon-section {
        padding: 1rem;
    }
    .ai-orb-container {
        width: 60px;
        height: 60px;
    }
    .orb-default {
        width: 45px;
        height: 45px;
    }
    .orb-circles {
        width: 60px;
        height: 60px;
    }
    .orb-circle.large {
        width: 12px;
        height: 12px;
    }
    .orb-circle.small {
        width: 6px;
        height: 6px;
    }
    .orb-circle:nth-child(1) { transform: translate(-50%, -50%) rotate(0deg) translateY(-24px); }
    .orb-circle:nth-child(2) { transform: translate(-50%, -50%) rotate(22.5deg) translateY(-24px); }
    .orb-circle:nth-child(3) { transform: translate(-50%, -50%) rotate(45deg) translateY(-24px); }
    .orb-circle:nth-child(4) { transform: translate(-50%, -50%) rotate(67.5deg) translateY(-24px); }
    .orb-circle:nth-child(5) { transform: translate(-50%, -50%) rotate(90deg) translateY(-24px); }
    .orb-circle:nth-child(6) { transform: translate(-50%, -50%) rotate(112.5deg) translateY(-24px); }
    .orb-circle:nth-child(7) { transform: translate(-50%, -50%) rotate(135deg) translateY(-24px); }
    .orb-circle:nth-child(8) { transform: translate(-50%, -50%) rotate(157.5deg) translateY(-24px); }
    .orb-circle:nth-child(9) { transform: translate(-50%, -50%) rotate(180deg) translateY(-24px); }
    .orb-circle:nth-child(10) { transform: translate(-50%, -50%) rotate(202.5deg) translateY(-24px); }
    .orb-circle:nth-child(11) { transform: translate(-50%, -50%) rotate(225deg) translateY(-24px); }
    .orb-circle:nth-child(12) { transform: translate(-50%, -50%) rotate(247.5deg) translateY(-24px); }
    .orb-circle:nth-child(13) { transform: translate(-50%, -50%) rotate(270deg) translateY(-24px); }
    .orb-circle:nth-child(14) { transform: translate(-50%, -50%) rotate(292.5deg) translateY(-24px); }
    .orb-circle:nth-child(15) { transform: translate(-50%, -50%) rotate(315deg) translateY(-24px); }
    .orb-circle:nth-child(16) { transform: translate(-50%, -50%) rotate(337.5deg) translateY(-24px); }
    .chat-area {
        padding: 0 1rem 1rem;
    }
    .welcome-message {
        padding: 2rem 1rem;
    }
    .welcome-message h2 {
        font-size: 1.4rem;
    }
    .welcome-message p {
        font-size: 0.9rem;
    }
    .messages-list {
        gap: 1.2rem;
    }
    .message-user .message-content {
        max-width: 85%;
        padding: 0.8rem 1rem;
    }
    .message-user .message-text {
        font-size: 0.9rem;
    }
    .message-ai {
        gap: 0.6rem;
    }
    .message-ai .ai-avatar {
        width: 32px;
        height: 32px;
    }
    .message-ai .message-content {
        max-width: 85%;
    }
    .message-ai .message-text {
        font-size: 0.9rem;
    }
    .message-ai .message-text code {
        font-size: 0.8rem;
    }
    .msg-action-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    .input-area {
        padding: 1rem;
    }
    .input-box textarea {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    .input-toolbar {
        padding: 0.4rem 0.8rem;
    }
    .toolbar-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    .char-count {
        font-size: 0.75rem;
    }
    .send-btn {
        width: 29.33px;
        height: 29.33px;
        font-size: 0.73rem;
    }
    .preset-overlay {
        padding: 1rem;
    }
    .preset-form {
        max-width: 100%;
    }
    .preset-form-header {
        padding: 1rem;
    }
    .preset-form-header h3 {
        font-size: 1rem;
    }
    .preset-close-btn {
        width: 32px;
        height: 32px;
    }
    .preset-form-body {
        padding: 1rem;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .form-label {
        font-size: 0.85rem;
    }
    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    .preset-form-footer {
        padding: 1rem;
    }
    .preset-submit-btn {
        padding: 0.8rem;
        font-size: 0.95rem;
    }
    .toast {
        bottom: 100px;
        padding: 0.7rem 1.2rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 0.6rem 0.8rem;
    }
    .main-title {
        font-size: 1rem;
    }
    .top-right {
        gap: 0.4rem;
    }
    .top-action-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    .top-right .top-action-btn:nth-child(3) {
        display: none;
    }
    #changelogDropdown .dropdown-menu {
        position: absolute;
        left: 0;
        right: auto;
        top: calc(100% + 6px);
        width: auto;
        min-width: 220px;
        z-index: 250;
    }
    #changelogDropdown .dropdown-item-name { font-size: 0.85rem; }
    #changelogDropdown .dropdown-item-desc { display: block; font-size: 0.75rem; }
    .ai-orb-container {
        width: 50px;
        height: 50px;
    }
    .orb-default {
        width: 38px;
        height: 38px;
    }
    .chat-area {
        padding: 0 0.8rem 0.8rem;
    }
    .input-area {
        padding: 0.8rem;
    }
    .welcome-message {
        padding: 1.5rem 0.8rem;
    }
    .welcome-message h2 {
        font-size: 1.2rem;
    }
    .message-user .message-content,
    .message-ai .message-content {
        max-width: 90%;
    }
    .toolbar-left {
        gap: 0.3rem;
    }
    .send-hint {
        display: none;
    }
    .toolbar-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .mode-toggle-btn {
        width: 28px;
        height: 28px;
    }
    .send-btn {
        width: 26.67px;
        height: 26.67px;
        font-size: 0.67rem;
    }
    .preset-overlay {
        padding: 0.5rem;
    }
    .preset-form-body {
        padding: 0.8rem;
    }
}

@media (max-height: 600px) and (orientation: landscape) {
    .ai-icon-section {
        padding: 0.8rem;
    }
    .ai-orb-container {
        width: 50px;
        height: 50px;
    }
    .orb-default {
        width: 38px;
        height: 38px;
    }
    .welcome-message {
        padding: 1.5rem 1rem;
    }
    .welcome-message h2 {
        font-size: 1.3rem;
        margin-bottom: 0.5rem;
    }
    .welcome-message p {
        font-size: 0.85rem;
    }
    .input-box textarea {
        min-height: 40px;
        max-height: 100px;
    }
    .preset-form {
        max-height: 90vh;
    }
}
.user-avatar.member {
    box-shadow: 3px 3px 0 var(--border-dark);
}

.member-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: var(--bg-white);
    border: 2px solid var(--border-dark);
    border-radius: 10px;
    padding: 0 6px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-dark);
    box-shadow: 2px 2px 0 var(--border-dark);
}
.switch { position: relative; display: inline-block; width: 26px; height: 16px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #e9e9e9; border: 1px solid #d0d0d0; border-radius: 999px; transition: all 0.2s ease; }
.slider:before { content: ""; position: absolute; width: 10px; height: 10px; top: 50%; left: 2px; transform: translateY(-50%); background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.15); transition: all 0.2s ease; }
.switch input:checked + .slider { background: var(--primary-green); border-color: var(--primary-green); }
.switch input:checked + .slider:before { transform: translate(14px, -50%); }
