/* ============================================
   NovelAI 图片生成器 - 样式表
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================
   CSS 变量
   ============================================ */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-input: #16162a;
    --bg-hover: #252542;
    
    --border: #2a2a4a;
    --border-light: #3a3a5a;
    
    --text: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b8a;
    
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    
    --transition: all 0.3s ease;
}

/* ============================================
   重置样式
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* 背景装饰 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   布局
   ============================================ */
.app {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ============================================
   侧边栏
   ============================================ */
.sidebar {
    width: 320px;
    min-width: 320px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.sidebar-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* ============================================
   设置组
   ============================================ */
.setting-group {
    margin-bottom: 24px;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.label-icon {
    font-size: 1rem;
}

/* ============================================
   输入框 & 选择框
   ============================================ */
.input,
.select,
.textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-muted);
}

.select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a0a0b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* ============================================
   尺寸选项
   ============================================ */
.size-options {
    display: flex;
    gap: 10px;
}

.size-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.size-btn:hover {
    border-color: var(--primary-light);
    background: var(--bg-hover);
}

.size-btn.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    color: var(--text);
}

.size-preview {
    background: var(--border-light);
    border-radius: 4px;
}

.size-preview.portrait {
    width: 20px;
    height: 30px;
}

.size-preview.landscape {
    width: 30px;
    height: 20px;
}

.size-preview.square {
    width: 25px;
    height: 25px;
}

.size-btn.active .size-preview {
    background: var(--primary);
}

/* ============================================
   开关
   ============================================ */
.toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--border);
    border-radius: 13px;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--text);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::after {
    transform: translateX(22px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   高级设置
   ============================================ */
.advanced-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.advanced-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--primary-light);
    color: var(--text);
}

.advanced-toggle.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    color: var(--text);
}

.toggle-arrow {
    margin-left: auto;
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.advanced-toggle.active .toggle-arrow {
    transform: rotate(180deg);
}

.advanced-panel {
    display: none;
    padding: 16px;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: -20px;
    margin-bottom: 20px;
}

.advanced-panel.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.advanced-panel .setting-group {
    margin-bottom: 16px;
}

.advanced-panel .setting-group:last-child {
    margin-bottom: 0;
}

/* 滑块样式 */
.slider {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.param-value {
    margin-left: auto;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* 种子输入组 */
.seed-input-group {
    display: flex;
    gap: 8px;
}

.seed-input {
    flex: 1;
}

.btn-icon {
    width: 44px;
    min-width: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-icon:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* ============================================
   按钮
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    width: 100%;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

/* ============================================
   主内容区
   ============================================ */
.main-content {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

/* ============================================
   输入区域
   ============================================ */
.input-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.prompt-container {
    margin-bottom: 20px;
}

.prompt-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}

.prompt-label .optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.textarea-small {
    min-height: 80px;
}

.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.generate-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.generate-info .divider {
    color: var(--border);
}

/* ============================================
   进度条
   ============================================ */
.progress-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
}

.progress-section.hidden {
    display: none;
}

.progress-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   图库区域
   ============================================ */
.gallery-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.gallery-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.image-count {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.gallery-empty p {
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* ============================================
   图片卡片
   ============================================ */
.image-card {
    position: relative;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.image-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.image-card img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}

.image-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    opacity: 0;
    transition: var(--transition);
}

.image-card:hover .image-card-overlay {
    opacity: 1;
}

.image-card-prompt {
    font-size: 0.85rem;
    color: white;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.image-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ============================================
   模态框
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: rotate(90deg);
}

.modal-image-container {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.modal-content img {
    max-width: 100%;
    max-height: 60vh;
    display: block;
    object-fit: contain;
}

.modal-info {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: 30vh;
}

.modal-prompt-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 12px;
    max-height: 100px;
}

.modal-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* ============================================
   Toast 通知
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 2000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.toast.error {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.toast.warning {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

/* ============================================
   加载动画
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.generating {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================================
   滚动条样式
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ============================================
   移动端头部栏
   ============================================ */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.mobile-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-spacer {
    width: 44px;
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    gap: 5px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: var(--transition);
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* 侧边栏关闭按钮 */
.close-sidebar {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.close-sidebar:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .mobile-header {
        display: flex;
    }
    
    .close-sidebar {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .app {
        flex-direction: column;
        padding-top: 60px;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        border-right: 1px solid var(--border);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-header {
        padding-right: 56px;
    }
    
    .sidebar-content {
        display: flex;
        flex-direction: column;
    }
    
    .setting-group {
        margin-bottom: 20px;
    }
    
    .main-content {
        padding: 20px;
        min-height: calc(100vh - 60px);
    }
}

@media (max-width: 768px) {
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    
    .action-bar {
        flex-direction: column;
        gap: 12px;
    }
    
    .generate-info {
        width: 100%;
        justify-content: center;
        font-size: 0.8rem;
    }
    
    .btn-large {
        width: 100%;
        padding: 14px 24px;
    }
    
    .modal-content {
        max-width: 95vw;
        max-height: 90vh;
        margin: 8px;
        border-radius: var(--radius);
    }
    
    .modal-content img {
        max-height: 45vh;
    }
    
    .modal-info {
        padding: 12px 16px;
        max-height: none;
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }
    
    .modal-prompt-container {
        flex: 1;
        overflow-y: auto;
        max-height: 80px;
        margin-bottom: 10px;
        padding-right: 4px;
    }
    
    .modal-info p {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .modal-actions {
        flex-direction: row;
        gap: 8px;
        flex-shrink: 0;
        padding-top: 10px;
    }
    
    .modal-actions .btn {
        flex: 1;
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .textarea {
        min-height: 100px;
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    .textarea-small {
        min-height: 70px;
    }
    
    .input, .select {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    .prompt-label {
        font-size: 0.95rem;
    }
    
    .gallery-header h2 {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 12px;
    }
    
    .input-section,
    .gallery-section {
        padding: 14px;
        border-radius: var(--radius-sm);
    }
    
    .input-section {
        margin-bottom: 16px;
    }
    
    .gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .image-card img {
        aspect-ratio: 1;
    }
    
    .image-card-overlay {
        padding: 10px;
    }
    
    .image-card-prompt {
        font-size: 0.75rem;
        -webkit-line-clamp: 1;
    }
    
    .image-card-meta {
        display: none;
    }
    
    .size-options {
        gap: 8px;
    }
    
    .size-btn {
        padding: 10px 8px;
        font-size: 0.75rem;
    }
    
    .size-preview.portrait {
        width: 16px;
        height: 24px;
    }
    
    .size-preview.landscape {
        width: 24px;
        height: 16px;
    }
    
    .size-preview.square {
        width: 20px;
        height: 20px;
    }
    
    .progress-section {
        padding: 14px;
    }
    
    .progress-text {
        font-size: 0.85rem;
    }
    
    .gallery-empty {
        padding: 40px 16px;
    }
    
    .empty-icon {
        font-size: 3rem;
    }
    
    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        padding: 14px 20px;
    }
    
    .modal-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .image-card-overlay {
        opacity: 1;
        background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.7));
    }
    
    .image-card:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .btn-primary:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    }
    
    .size-btn:hover {
        border-color: var(--border);
        background: var(--bg-input);
    }
    
    .size-btn.active:hover {
        border-color: var(--primary);
        background: rgba(99, 102, 241, 0.15);
    }
}

/* 安全区域适配（刘海屏等） */
@supports (padding: max(0px)) {
    .mobile-header {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
    
    .main-content {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .toast {
        bottom: max(16px, env(safe-area-inset-bottom));
    }
}

/* ============================================
   帮助模态框
   ============================================ */
.help-btn-mobile {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.help-btn-mobile:hover {
    background: var(--bg-hover);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.help-modal-content {
    max-width: 700px;
    width: 95vw;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.help-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.help-modal-body h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.help-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.help-section h3 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 12px;
}

.help-section ol,
.help-section ul {
    margin-left: 20px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.help-section li {
    margin-bottom: 8px;
}

.help-section code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    color: var(--primary-light);
}

.help-section kbd {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-family: inherit;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 2px 0 var(--border);
    color: var(--text);
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.help-table tr {
    border-bottom: 1px solid var(--border);
}

.help-table tr:last-child {
    border-bottom: none;
}

.help-table td {
    padding: 10px 8px;
    vertical-align: top;
}

.help-table td:first-child {
    width: 140px;
    color: var(--text);
    white-space: nowrap;
}

.help-table td:last-child {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .help-modal-content {
        max-height: 80vh;
    }
    
    .help-modal-body {
        padding: 16px;
    }
    
    .help-modal-body h2 {
        font-size: 1.25rem;
        margin-bottom: 16px;
    }
    
    .help-section h3 {
        font-size: 1rem;
    }
    
    .help-table td:first-child {
        width: auto;
        display: block;
        padding-bottom: 4px;
    }
    
    .help-table td:last-child {
        display: block;
        padding-top: 0;
        padding-left: 0;
    }
    
    .help-table tr {
        display: block;
        padding: 8px 0;
    }
}

/* 横屏适配 */
@media (max-height: 500px) and (orientation: landscape) {
    .mobile-header {
        height: 50px;
    }
    
    .app {
        padding-top: 50px;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .textarea {
        min-height: 80px;
    }
    
    .textarea-small {
        min-height: 60px;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .modal-content img {
        max-height: 60vh;
    }
}
