/* ============================================
   凡星社 10秒AI矩阵 - 主样式表
   ============================================ */

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* 页面加载动画 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.page-loader.active {
    opacity: 1;
    visibility: visible;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    
    --bg-dark: #0a0a1a;
    --bg-card: #ffffff;
    --bg-elevated: #1a1a2e;
    --bg-chat: #f8f9fa;
    
    --text-primary: #ffffff;
    --text-secondary: rgba(255,255,255,0.7);
    --text-muted: rgba(255,255,255,0.5);
    --text-dark: #1f2937;
    --text-dark-secondary: #6b7280;
    
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --nav-height: 64px;
}

html {
    scroll-behavior: smooth;
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   主内容区
   ============================================ */
.main-content-mobile {
    padding: 16px;
    padding-bottom: 80px;
}

.header-mobile {
    text-align: center;
    margin-bottom: 20px;
}

.header-mobile h1 {
    font-size: 24px;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.header-mobile p {
    font-size: 13px;
    color: var(--text-muted);
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-left: 4px;
}

/* ============================================
   记忆模块
   ============================================ */
.memory-section {
    background: var(--bg-elevated);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 24px;
}

.memory-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.memory-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.memory-tab.active {
    background: rgba(102, 126, 234, 0.1);
    color: white;
    border-bottom: 2px solid var(--primary-color);
}

.memory-tab span:first-child {
    font-size: 24px;
}

.memory-tab span:nth-child(2) {
    font-size: 14px;
    font-weight: 600;
}

.memory-tab small {
    font-size: 10px;
    opacity: 0.7;
}

.memory-content {
    min-height: 400px;
}

.memory-library,
.memory-gallery {
    display: flex;
    min-height: 400px;
}

.memory-sidebar {
    width: 140px;
    background: rgba(0, 0, 0, 0.2);
    padding: 16px 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.memory-category {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.memory-category:hover {
    background: rgba(255, 255, 255, 0.05);
}

.memory-category.active {
    background: var(--primary-gradient);
    color: white;
}

.memory-main-area {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

/* 上传区域 */
.memory-upload-zone {
    border: 2px dashed rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(102, 126, 234, 0.05);
}

.memory-upload-zone:hover {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.memory-upload-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.15);
}

.upload-icon-large {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.upload-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    color: var(--primary-color);
}

.status-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 记忆列表 */
.memory-list-container {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    color: var(--text-secondary);
}

.item-count {
    color: var(--text-muted);
}

.memory-list {
    max-height: 300px;
    overflow-y: auto;
}

.memory-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.2s;
}

.memory-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.item-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.item-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

.item-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

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

.btn-delete {
    opacity: 0.5;
}

.btn-delete:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.2);
}

/* 空状态 */
.memory-empty-state,
.memory-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.memory-empty-state span,
.memory-empty span {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.memory-empty-state p,
.memory-empty p {
    font-size: 14px;
    margin-bottom: 8px;
}

.memory-empty-state small,
.memory-empty small {
    font-size: 12px;
    opacity: 0.7;
}

/* 弹窗 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-elevated);
    border-radius: 20px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.modal-content.modal-large {
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
}

.modal-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-content > p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-secondary {
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    padding: 10px 20px;
    border: none;
    background: #ef4444;
    color: white;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-danger-low {
    padding: 10px 20px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-danger-low:hover {
    background: rgba(239, 68, 68, 0.2);
}

.markdown-preview {
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* ============================================
   记忆图库样式
   ============================================ */
.gallery-search {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 14px;
    border-radius: 10px;
}

.search-icon {
    font-size: 16px;
    opacity: 0.5;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tag:hover {
    background: rgba(255, 255, 255, 0.1);
}

.filter-tag.active {
    background: var(--primary-gradient);
    color: white;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.gallery-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: rgba(0, 0, 0, 0.2);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    opacity: 0;
    transition: opacity 0.2s;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.gallery-item-tags .tag {
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 10px;
    color: white;
}

.gallery-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.gallery-empty span {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.gallery-empty p {
    font-size: 14px;
    margin-bottom: 8px;
}

.gallery-empty small {
    font-size: 12px;
    opacity: 0.7;
}

/* 图片预览弹窗 */
.modal-image {
    padding: 0;
    overflow: hidden;
}

.modal-image img {
    width: 100%;
    max-height: 50vh;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.5);
}

.image-info {
    padding: 16px;
}

.image-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}

.tag-item {
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 16px;
    font-size: 12px;
    color: var(--primary-color);
}

.no-tags {
    font-size: 12px;
    color: var(--text-muted);
}

.image-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Toast */
.toast-message {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-dark);
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    animation: fadeInUp 0.3s ease;
}

/* ============================================
   AI助手对话框（分类标签和全部工具之间）
   ============================================ */
.ai-chat-section {
    margin: 20px 0;
}

.ai-chat-box {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ai-chat-messages {
    padding: 16px;
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-chat);
}

.ai-welcome-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
}

.ai-avatar-small {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ai-welcome-text {
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.5;
}

.ai-chat-input-area {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.ai-chat-input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    background: #f9fafb;
    color: var(--text-dark);
}

.ai-chat-input-area input:focus {
    border-color: var(--primary-color);
    background: white;
}

.ai-chat-input-area button {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.ai-chat-input-area button:hover {
    transform: scale(1.05);
}

/* 消息样式 */
.message {
    margin-bottom: 12px;
    display: flex;
}

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

.message.assistant-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.user-message .message-content {
    background: var(--primary-gradient);
    color: white;
    border-bottom-right-radius: 4px;
}

.assistant-message .message-content {
    background: white;
    color: var(--text-dark);
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

/* 打字动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 14px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 工具链接 */
.tool-link {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
}

/* ============================================
   工具卡片网格
   ============================================ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.tool-card {
    background: var(--bg-elevated);
    border-radius: 16px;
    padding: 20px 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tool-card:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    border-color: rgba(102, 126, 234, 0.2);
}

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

.tool-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.tool-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tool-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* 动画 */
.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   分类导航
   ============================================ */
.category-scroll-container {
    margin-bottom: 20px;
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px;
}

.category-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
}

.category-scroll::-webkit-scrollbar {
    display: none;
}

.category-pill {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 20px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    scroll-snap-align: start;
    min-width: 64px;
}

.category-pill:active {
    transform: scale(0.95);
}

.category-pill.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
}

.pill-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.pill-text {
    font-size: 13px;
    font-weight: 600;
}

.pill-sub {
    font-size: 10px;
    opacity: 0.7;
    font-weight: 400;
}

/* ============================================
   AI助手对话框
   ============================================ */
.ai-assistant-section {
    margin-bottom: 24px;
}

.ai-chat-card {
    background: var(--bg-card);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.ai-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--primary-gradient);
    color: white;
}

.ai-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.ai-info {
    flex: 1;
}

.ai-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.ai-info p {
    font-size: 12px;
    opacity: 0.9;
}

.ai-status {
    font-size: 11px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    font-weight: 500;
}

.ai-chat-messages {
    padding: 16px;
    height: 180px;
    min-height: 180px;
    max-height: 180px;
    overflow-y: auto;
    background: var(--bg-chat);
}

.ai-message {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-avatar-small {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ai-message.user .ai-avatar-small {
    background: #e5e7eb;
}

.ai-message-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    font-size: 14px;
    color: var(--text-dark);
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    max-width: calc(100% - 50px);
}

.ai-message.user .ai-message-bubble {
    background: var(--primary-gradient);
    color: white;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 4px;
}

.ai-chat-input-area {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.ai-chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    background: #f9fafb;
    color: var(--text-dark);
}

.ai-chat-input-area input:focus {
    border-color: var(--primary-color);
    background: white;
}

.ai-send-btn {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

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

/* 打字动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); }
}

/* ============================================
   快捷入口
   ============================================ */
.quick-actions {
    margin-bottom: 24px;
}

.quick-actions-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 16px;
    padding-right: 16px;
}

.quick-actions-scroll::-webkit-scrollbar {
    display: none;
}

.quick-action-card {
    flex-shrink: 0;
    width: 100px;
    padding: 16px 12px;
    background: var(--bg-card);
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease;
    scroll-snap-align: start;
}

.quick-action-card:active {
    transform: scale(0.95);
}

.quick-action-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.quick-action-name {
    font-size: 12px;
    color: #1f2937;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   工具卡片
   ============================================ */
.tools-section {
    margin-bottom: 24px;
}

.grid-mobile {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.card-mobile {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.card-mobile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.2s ease;
}

.card-mobile:active {
    transform: scale(0.97);
}

.card-mobile:active::before {
    transform: scaleX(1);
}

.card-icon-mobile {
    font-size: 40px;
    margin-bottom: 10px;
    display: block;
}

.card-mobile h3 {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-mobile p {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-category-tag {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 6px;
    background: rgba(102, 126, 234, 0.15);
    color: var(--primary-color);
    font-size: 9px;
    font-weight: 600;
    border-radius: 10px;
    text-transform: uppercase;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* 页脚 */
.footer-mobile {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
}

/* ============================================
   底部导航栏
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(10, 10, 26, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 998;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 22px;
}

.nav-label {
    font-size: 10px;
    font-weight: 500;
}

/* ============================================
   工具模态框
   ============================================ */
.tool-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.tool-modal.active {
    display: flex;
}

.tool-modal-header {
    background: var(--bg-elevated);
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.back-to-matrix-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-to-matrix-btn:active {
    background: rgba(255,255,255,0.15);
    transform: scale(0.95);
}

.btn-icon {
    font-size: 14px;
}

.tool-modal-header h2 {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-modal-close {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-modal-close:active {
    background: rgba(255,255,255,0.15);
    transform: scale(0.95);
}

.tool-iframe-container {
    flex: 1;
    position: relative;
    background: #000;
    overflow: hidden;
}

#tool-iframe {
    width: 100%;
    height: 100%;
    border: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* 加载提示 */
.tool-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.loading-error {
    text-align: center;
    color: var(--text-secondary);
}

/* ============================================
   桌面端适配
   ============================================ */
@media (min-width: 769px) {
    .main-content-mobile {
        max-width: 600px;
        margin: 0 auto;
        padding: 40px;
    }
    
    .grid-mobile {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .bottom-nav {
        display: none;
    }
    
    body {
        padding-bottom: 40px;
    }
    
    .ai-chat-messages {
        height: 220px;
        min-height: 220px;
        max-height: 220px;
    }
}
