/* Max Image Canvas - 现代化CSS样式系统 */
/* 仿照 http://seer520.com/tools/tpsc/tpsc3.html 风格设计 */

/* ==========================================================================
   基础样式重置和变量定义
   ========================================================================== */

/* CSS变量系统 - 现代化配色方案 */
:root {
    /* 主色调 - 现代化蓝色系 */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;
    
    /* 辅助色 - 现代化绿色系 */
    --secondary-50: #f0fdf4;
    --secondary-100: #dcfce7;
    --secondary-200: #bbf7d0;
    --secondary-300: #86efac;
    --secondary-400: #4ade80;
    --secondary-500: #22c55e;
    --secondary-600: #16a34a;
    --secondary-700: #15803d;
    --secondary-800: #166534;
    --secondary-900: #14532d;
    
    /* 中性色 - 现代化灰色系 */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* 功能色 */
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --info: #06b6d4;
    
    /* 尺寸系统 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    
    /* 阴影系统 - 现代化阴影 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    
    /* 动画系统 */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 字体系统 */
    --font-family-sans: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-mono: 'JetBrains Mono', 'SF Mono', 'Courier New', monospace;
    
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
}

/* 基础重置 */

button, input, select {
    border-width: 0px;
    cursor: pointer;
}

.max-imgcanvas-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.max-imgcanvas-container {
    font-family: var(--font-family-sans);
    line-height: var(--line-height-normal);
    color: var(--gray-900);
    background-color: var(--gray-50);
    min-height: 100vh;
}

/* ==========================================================================
   布局系统 - 现代化布局
   ========================================================================== */

/* 容器系统 */
.container {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

/* 网格系统 - 现代化网格布局 */
.grid {
    display: grid;
    gap: var(--space-3);
}
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-2-3 { grid-template-columns: 1fr 2fr; }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* 响应式网格 */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: 1fr 2fr; } 
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:col-span-1 { grid-column: span 1 / span 1; }
    .lg\:col-span-2 { grid-column: span 2 / span 2; }
}

/* 间距系统 - 现代化间距 */
.space-y-2 > * + * { margin-top: var(--space-2); }
.space-y-3 > * + * { margin-top: var(--space-3); }
.space-y-4 > * + * { margin-top: var(--space-4); }
.space-y-6 > * + * { margin-top: var(--space-6); }
.space-y-8 > * + * { margin-top: var(--space-8); }
.space-y-10 > * + * { margin-top: var(--space-10); }

.space-x-2 > * + * { margin-left: var(--space-2); }
.space-x-3 > * + * { margin-left: var(--space-3); }
.space-x-4 > * + * { margin-left: var(--space-4); }
.space-x-6 > * + * { margin-left: var(--space-6); }

/* ==========================================================================
   卡片和面板系统 - 现代化设计
   ========================================================================== */

/* 基础卡片样式 */
.card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
    border-color: var(--gray-300);
}

.card-header {
    padding: var(--space-6) var(--space-6) 0;
    border-bottom: 1px solid var(--gray-100);
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: 0 var(--space-6) var(--space-6);
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* 控制面板专用样式 */
.control-panel {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.control-panel:hover {
    box-shadow: var(--shadow-lg);
}

.control-panel-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--gray-200);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--gray-50) 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    font-weight: var(--font-weight-semibold);
    color: var(--gray-800);
    font-size: var(--font-size-lg);
}

.control-panel-body {
    padding: var(--space-6);
}

.control-panel-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* 面板样式 */
.panel {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.panel-header {
    padding: var(--space-5) var(--space-6);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--gray-50) 100%);
    border-bottom: 1px solid var(--gray-200);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    font-weight: var(--font-weight-semibold);
    color: var(--gray-800);
    font-size: var(--font-size-lg);
}

.panel-body {
    padding: var(--space-6);
}

/* ==========================================================================
   图标系统 - 左侧控制面板专用
   ========================================================================== */

/* 图标基础样式 */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    font-size: inherit;
    color: inherit;
}

/* 控制面板图标专用样式 */
.control-icon {
    width: 1.25em;
    height: 1.25em;
    color: var(--primary-600);
    transition: color var(--transition-fast);
}

.control-panel:hover .control-icon {
    color: var(--primary-700);
}

/* 图标颜色变体 */
.icon-primary { color: var(--primary-600); }
.icon-secondary { color: var(--secondary-600); }
.icon-success { color: var(--success); }
.icon-warning { color: var(--warning); }
.icon-danger { color: var(--danger); }
.icon-gray { color: var(--gray-500); }

/* 图标尺寸 */
.icon-xs { width: 1em; height: 1em; }
.icon-sm { width: 1.25em; height: 1.25em; }
.icon-md { width: 1.5em; height: 1.5em; }
.icon-lg { width: 2em; height: 2em; }
.icon-xl { width: 2.5em; height: 2.5em; }

/* ==========================================================================
   表单控件系统 - 现代化设计
   ========================================================================== */

/* 表单标签 */
.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

/* 输入框样式 */
.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    background: white;
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
    color: var(--gray-800);
    font-family: var(--font-family-sans);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgb(14 165 233 / 0.1);
    transform: translateY(-1px);
}

.form-input::placeholder {
    color: var(--gray-500);
    opacity: 0.7;
}

/* 选择框样式 */
.form-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    background: white;
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
    color: var(--gray-800);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right var(--space-3) center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: var(--space-10);
    font-family: var(--font-family-sans);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgb(14 165 233 / 0.1);
    transform: translateY(-1px);
}

/* 颜色选择器样式 */
.form-color {
    width: 100%;
    height: 2.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    background: white;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-color:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgb(14 165 233 / 0.1);
    transform: translateY(-1px);
}

/* 滑块样式 */
.form-range {
    width: 100%;
    height: 0.375rem;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    outline: none;
    appearance: none;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary-500);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
}

.form-range::-webkit-slider-thumb:hover {
    background: var(--primary-600);
    transform: scale(1.1);
}

.form-range::-moz-range-thumb {
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary-500);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid white;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-fast);
}

.form-range::-moz-range-thumb:hover {
    background: var(--primary-600);
    transform: scale(1.1);
}

/* ==========================================================================
   按钮系统 - 现代化设计
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-5);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    user-select: none;
    font-family: var(--font-family-sans);
    position: relative;
    overflow: hidden;
    gap: var(--space-2);
    line-height: var(--line-height-normal);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgb(14 165 233 / 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 主按钮 */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
    color: white;
    border-color: var(--primary-500);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    border-color: var(--primary-600);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

/* 次要按钮 */
.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-800);
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
    border-color: var(--gray-400);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* 轮廓按钮 */
.btn-outline {
    background: transparent;
    color: var(--primary-500);
    border-color: var(--primary-500);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover:not(:disabled) {
    background: var(--primary-500);
    color: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* 危险按钮 */
.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    border-color: var(--danger);
    box-shadow: var(--shadow-md);
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    border-color: #dc2626;
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

/* 按钮尺寸 */
.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--font-size-base);
    border-radius: var(--radius-xl);
}

/* 按钮组 */
.btn-group {
    display: inline-flex;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.btn-group .btn {
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--gray-300);
    box-shadow: none;
}

.btn-group .btn:last-child {
    border-right: none;
}

.btn-group .btn:hover {
    transform: none;
}

/* ==========================================================================
   对齐控件系统 - 左侧控制面板专用
   ========================================================================== */

/* 对齐按钮组 */
.align-group {
    display: flex;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--gray-50);
}

.align-btn {
    flex: 1;
    padding: var(--space-3) var(--space-2);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    font-size: var(--font-size-sm);
}

.align-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.align-btn.active {
    background: var(--primary-500);
    color: white;
}

.align-btn:not(:last-child) {
    border-right: 1px solid var(--gray-300);
}

/* 文字样式按钮组 */
.text-style-group {
    display: flex;
    gap: var(--space-2);
}

.text-style-btn {
    flex: 1;
    padding: var(--space-3);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    font-size: var(--font-size-sm);
}

.text-style-btn:hover {
    border-color: var(--primary-300);
    color: var(--primary-600);
}

.text-style-btn.active {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: white;
}

/* ==========================================================================
   预览区域样式 - 现代化设计
   ========================================================================== */

.preview-container {
    background: white;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: all var(--transition-normal);
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-container:hover {
    box-shadow: var(--shadow-2xl);
    border-color: var(--gray-300);
    transform: translateY(-2px);
}

.image-preview {
    width: 100%;
    height: 320px;
    background: linear-gradient(45deg, var(--gray-100) 25%, transparent 25%), 
                linear-gradient(-45deg, var(--gray-100) 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, var(--gray-100) 75%), 
                linear-gradient(-45deg, transparent 75%, var(--gray-100) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.text-display {
    font-size: 2.25rem;
    font-weight: var(--font-weight-bold);
    color: var(--gray-800);
    text-align: center;
    padding: var(--space-6);
    max-width: 100%;
    word-wrap: break-word;
    white-space: pre-line;
    line-height: var(--line-height-relaxed);
    font-family: var(--font-family-sans);
}

.alignment-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alignment-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    box-sizing: border-box;
}

/* ==========================================================================
   工具提示和状态提示 - 现代化设计
   ========================================================================== */

/* 下载提示 */
#download-toast {
    position: fixed;
    top: 40px;
    left: 50%;
    color: white;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    z-index: 1000;
    font-weight: var(--font-weight-medium);
    border: 1px solid rgb(16 185 129 / 0.2);
    transform: translateY(calc(0 + var(--space-6)));
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    opacity: 0;
    align-items: center;
    gap: var(--space-2);
    max-width: 300px;
}

.download-toast.show {
    transform:  translateY(100%) !important; 
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%) !important;
    opacity: 1 !important;
}

.download-toast.error {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%) !important;
    opacity: 0;
}

/* 工具提示 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    background: var(--gray-900);
    color: white;
    text-align: center;
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-3);
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: all var(--transition-fast);
    font-size: var(--font-size-xs);
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
    font-weight: var(--font-weight-medium);
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* ==========================================================================
   渐变和图案样式 - 现代化设计
   ========================================================================== */

/* 渐变预设 */
.gradient-preset {
    width: 100%;
    height: 50px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.gradient-preset:hover {
    transform: scale(1.05);
    border-color: var(--primary-500);
    box-shadow: var(--shadow-lg);
}

.gradient-preset.active {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-xl);
    transform: scale(1.02);
}

.bg-gradient-1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.bg-gradient-2 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.bg-gradient-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.bg-gradient-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.bg-gradient-5 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }

/* 图案样式 */
.pattern-dots {
    background-image: radial-gradient(var(--pattern-color, #FFFFFF) 2px, transparent 2px);
    background-size: var(--pattern-size, 20px) var(--pattern-size, 20px);
}

.pattern-lines {
    background-image: linear-gradient(to right, var(--pattern-color, #FFFFFF) 1px, transparent 1px);
    background-size: var(--pattern-size, 20px) var(--pattern-size, 20px);
}

.pattern-grid {
    background-image: linear-gradient(to right, var(--pattern-color, #FFFFFF) 1px, transparent 1px), 
                     linear-gradient(to bottom, var(--pattern-color, #FFFFFF) 1px, transparent 1px);
    background-size: var(--pattern-size, 20px) var(--pattern-size, 20px);
}

/* ==========================================================================
   历史记录样式 - 现代化设计
   ========================================================================== */

.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.history-item:hover {
    background: var(--gray-100);
    transform: translateX(4px);
    border-color: var(--gray-200);
    box-shadow: var(--shadow-md);
}

.history-preview {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    font-weight: var(--font-weight-medium);
    border: 2px solid var(--gray-300);
}

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

.history-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--space-1);
}

.history-time {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    font-weight: var(--font-weight-medium);
}

/* ==========================================================================
   加载动画 - 现代化设计
   ========================================================================== */

.loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--gray-200);
    border-left-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: var(--shadow-md);
}

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

.loading-pulse {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--primary-500);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* ==========================================================================
   无障碍性和辅助功能 - 现代化设计
   ========================================================================== */

/* 屏幕阅读器专用 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 焦点样式 */
.focus-visible:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* 焦点可见性改进 */
.focus\:outline-none:focus {
    outline: none;
}

.focus\:ring-2:focus {
    box-shadow: 0 0 0 2px rgb(14 165 233 / 0.5);
}

.focus\:ring-primary:focus {
    box-shadow: 0 0 0 3px rgb(14 165 233 / 0.1);
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .btn-primary {
        background: var(--primary-700);
        border-color: var(--primary-800);
    }
    
    .form-input:focus {
        border-color: var(--primary-700);
    }
    
    .btn-secondary {
        background-color: var(--secondary-700);
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .transition-custom,
    .btn,
    .card,
    .history-item,
    .gradient-preset {
        transition: none;
    }
    
    .history-item:hover,
    .gradient-preset:hover {
        transform: none;
    }
    
    @keyframes spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }
}

/* ==========================================================================   文字格式化样式   ========================================================================== */

/* 水平对齐样式 */
.text-left {
    text-align: left !important;
}

.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

/* 垂直对齐样式 */
.align-items-start {
    align-items: flex-start !important;
}

.align-items-center {
    align-items: center !important;
}

.align-items-end {
    align-items: flex-end !important;
}

.justify-content-start {
    justify-content: flex-start !important;
}

.justify-content-center {
    justify-content: center !important;
}

.justify-content-end {
    justify-content: flex-end !important;
}

/* 文字样式 */
.font-bold {
    font-weight: var(--font-weight-bold) !important;
}

.font-italic {
    font-style: italic !important;
}

.font-underline {
    text-decoration: underline !important;
}

/* 文字阴影样式 */
.text-shadow-none {
    text-shadow: none !important;
}

.text-shadow-normal {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.text-shadow-large {
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* 行高样式 */
.line-height-10 {
    line-height: 1.0 !important;
}

.line-height-12 {
    line-height: 1.2 !important;
}

.line-height-14 {
    line-height: 1.4 !important;
}

.line-height-16 {
    line-height: 1.6 !important;
}

.line-height-18 {
    line-height: 1.8 !important;
}

.line-height-20 {
    line-height: 2.0 !important;
}

.line-height-22 {
    line-height: 2.2 !important;
}

.line-height-24 {
    line-height: 2.4 !important;
}

.line-height-26 {
    line-height: 2.6 !important;
}

.line-height-28 {
    line-height: 2.8 !important;
}

.line-height-30 {
    line-height: 3.0 !important;
}

/* ==========================================================================
   响应式设计 - 现代化设计
   ========================================================================== */

@media (max-width: 1024px) {
    .container {
        padding: 0 var(--space-5);
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }
    
    .lg\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
    
    .preview-container {
        min-height: 350px;
    }
    
    .text-display {
        font-size: 1.875rem;
        padding: var(--space-5);
    }
    
    .control-panel {
        margin-bottom: var(--space-6);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 var(--space-4);
    }
    
    .grid {
        gap: var(--space-6);
    }
    
    .preview-container {
        min-height: 300px;
        border-radius: var(--radius-xl);
    }
    
    .text-display {
        font-size: 1.5rem;
        padding: var(--space-4);
    }
    
    .card-body {
        padding: var(--space-4);
    }
    
    .panel-body {
        padding: var(--space-4);
    }
    
    .btn {
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-sm);
    }
    
    .btn-lg {
        padding: var(--space-3) var(--space-5);
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-3);
    }
    
    .grid {
        gap: var(--space-4);
    }
    
    .preview-container {
        min-height: 280px;
        border-radius: var(--radius-lg);
    }
    
    .image-preview {
        height: 280px;
    }
    
    .text-display {
        font-size: 1.25rem;
        padding: var(--space-3);
        line-height: var(--line-height-normal);
    }
    
    .card-body {
        padding: var(--space-3);
    }
    
    .panel-body {
        padding: var(--space-3);
    }
    
    .btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-xs);
        border-radius: var(--radius-md);
    }
    
    .btn-lg {
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-sm);
    }
    
    .gradient-preset {
        height: 60px;
    }
    
    .history-item {
        padding: var(--space-3);
    }
    
    .history-preview {
        width: 40px;
        height: 40px;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #0f172a;
        --gray-100: #1e293b;
        --gray-200: #334155;
        --gray-300: #475569;
        --gray-400: #64748b;
        --gray-500: #94a3b8;
        --gray-600: #cbd5e1;
        --gray-700: #e2e8f0;
        --gray-800: #f1f5f9;
        --gray-900: #f8fafc;
    }
    
    .card,
    .panel,
    .control-panel,
    .preview-container {
        background: var(--gray-100);
        border-color: var(--gray-300);
        color: var(--gray-800);
    }
    
    .form-input,
    .form-select,
    .form-color {
        background: var(--gray-200);
        border-color: var(--gray-400);
        color: var(--gray-800);
    }
    
    .form-input:focus,
    .form-select:focus,
    .form-color:focus {
        border-color: var(--primary-400);
    }
}

/* ==========================================================================
   工具类系统
   ========================================================================== */

/* 显示工具类 */
.flex { display: flex; }
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* 透明度工具类 */
.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }

/* 对齐工具类 */
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }



/* 字体大小 */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); margin: 10px 0px 10px 0px;}
.text-2xl { font-size: var(--font-size-2xl); }

/* 字体权重 */
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* 颜色工具类 */
.text-primary { color: var(--primary-600); }
.text-secondary { color: var(--secondary-600); }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-700 { color: var(--gray-700); }
.text-white { color: white; }

/* 背景颜色 */
.bg-white { background-color: white; }
.bg-red-500{ background-color:#dc2626 ; }
.bg-gray-50 { background-color: var(--gray-50); }
.bg-gray-100 { background-color: var(--gray-100); }
.bg-gray-200 { background-color: var(--gray-200); }
.bg-primary500 { background-color: var(--primary-500); }
.bg-primary900 { background-color: var(--primary-900); }
.bg-secondary { background-color: var(--secondary-800); }
.bg-primary {background-color: var(--secondary-500);}


/* flex弹性布局 */
.flex-1 {    flex: 1 1 0%;}

/* 边距工具类 */
.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.ml-1 { margin-left: var(--space-1); }
.ml-2 { margin-left: var(--space-2); }
.mr-1 { margin-right: var(--space-1); }
.mr-2 { margin-right: var(--space-2); }

/* 填充工具类 */
.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }

.py-1 { padding-top: var(--space-1) !important; padding-bottom: var(--space-1) !important; }
.py-2 { padding-top: var(--space-2)!important; padding-bottom: var(--space-2) !important; }
.py-3 { padding-top: var(--space-3)!important; padding-bottom: var(--space-3) !important; }
.py-4 { padding-top: var(--space-4)!important; padding-bottom: var(--space-4) !important; }

/* 宽度和高度 */
.w-full { width: 100%; }
.w-10 { width: 2.5rem; }
.w-auto { width: auto; }

.h-10 { height: 2.5rem; }
.h-8 { height: 2rem; }
.h-auto { height: auto; }

/* 圆角 */
.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-md); }
.rounded-xl { border-radius: var(--radius-lg); }

/* 阴影 */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* 过渡动画 */
.transition-custom { transition: all var(--transition-normal); }

/* 悬停效果 */
.hover\:bg-gray-100:hover { background-color: var(--gray-100); }
.hover\:bg-gray-200:hover { background-color: var(--gray-200); }
.hover\:text-primary:hover { color: var(--primary-600); }

/* 响应式显示 */
@media (min-width: 640px) {
    .sm\:block { display: block; }
    .sm\:hidden { display: none; }
    .sm\:flex { display: flex; }
}

@media (min-width: 768px) {
    .md\:block { display: block; }
    .md\:hidden { display: none; }
    .md\:flex { display: flex; }
}

@media (min-width: 1024px) {
    .lg\:block { display: block; }
    .lg\:hidden { display: none; }
    .lg\:flex { display: flex; }
}

/* ==========================================================================
   特殊组件样式
   ========================================================================== */

/* 自定义滚动条 */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* 粘性头部 */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: white;
    box-shadow: var(--shadow-md);
}

/* 响应式文本 */
.text-responsive {
    font-size: clamp(1rem, 3vw, 1.5rem);
}

/* 渐变文本 */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 边框工具类 */
.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-dashed { border-style: dashed; }

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 28rem;
    margin: var(--space-4);
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

/* 更多图案样式 */
.pattern-cross {
    background-image: linear-gradient(to right, var(--pattern-color, #FFFFFF) 1px, transparent 1px),
                     linear-gradient(to bottom, var(--pattern-color, #FFFFFF) 1px, transparent 1px),
                     linear-gradient(45deg, var(--pattern-color, #FFFFFF) 1px, transparent 1px),
                     linear-gradient(135deg, var(--pattern-color, #FFFFFF) 1px, transparent 1px);
    background-size: var(--pattern-size, 20px) var(--pattern-size, 20px);
}

.pattern-chevron {
    background-image: linear-gradient(135deg, var(--pattern-color, #FFFFFF) 25%, transparent 25%) calc(-var(--pattern-size, 20px)/2) 0,
                     linear-gradient(225deg, var(--pattern-color, #FFFFFF) 25%, transparent 25%) calc(-var(--pattern-size, 20px)/2) 0,
                     linear-gradient(315deg, var(--pattern-color, #FFFFFF) 25%, transparent 25%),
                     linear-gradient(45deg, var(--pattern-color, #FFFFFF) 25%, transparent 25%);
    background-size: var(--pattern-size, 20px) var(--pattern-size, 20px);
}

/* ==========================================================================
   左侧控制面板专用图标样式
   ========================================================================== */

/* 文字设置图标 */
.icon-text {
    background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M13 6v15h-2V6H5V4h14v2h-6z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M13 6v15h-2V6H5V4h14v2h-6z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* 字体图标 */
.icon-font {
    background: linear-gradient(135deg, var(--secondary-400), var(--secondary-600));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3v-3H3v3z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M9 4v3h5v12h3V7h5V4H9zm-6 8h3v7h3v-7h3v-3H3v3z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* 颜色图标 */
.icon-color {
    background: linear-gradient(135deg, var(--warning), var(--danger));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* 对齐图标 */
.icon-align-left {
    background: linear-gradient(135deg, var(--info), var(--primary-600));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M3 3h18v2H3V3zm0 4h12v2H3V7zm0 4h18v2H3v-2zm0 4h12v2H3v-2zm0 4h18v2H3v-2z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M3 3h18v2H3V3zm0 4h12v2H3V7zm0 4h18v2H3v-2zm0 4h12v2H3v-2zm0 4h18v2H3v-2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.icon-align-center {
    background: linear-gradient(135deg, var(--info), var(--primary-600));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M3 3h18v2H3V3zm4 4h10v2H7V7zm-4 4h18v2H3v-2zm4 4h10v2H7v-2zm-4 4h18v2H3v-2z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M3 3h18v2H3V3zm4 4h10v2H7V7zm-4 4h18v2H3v-2zm4 4h10v2H7v-2zm-4 4h18v2H3v-2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.icon-align-right {
    background: linear-gradient(135deg, var(--info), var(--primary-600));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M3 3h18v2H3V3zm6 4h12v2H9V7zm-6 4h18v2H3v-2zm6 4h12v2H9v-2zm-6 4h18v2H3v-2z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M3 3h18v2H3V3zm6 4h12v2H9V7zm-6 4h18v2H3v-2zm6 4h12v2H9v-2zm-6 4h18v2H3v-2z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* 背景设置图标 */
.icon-background {
    background: linear-gradient(135deg, var(--success), var(--secondary-600));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* 渐变图标 */
.icon-gradient {
    background: linear-gradient(135deg, var(--primary-400), var(--accent));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M11 3v18H9V3h2zm2 0h2v18h-2V3zm4 0h2v18h-2V3z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M11 3v18H9V3h2zm2 0h2v18h-2V3zm4 0h2v18h-2V3z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* 图案图标 */
.icon-pattern {
    background: linear-gradient(135deg, var(--warning), var(--danger));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M4 4h7v7H4V4zm9 0h7v7h-7V4zm-9 9h7v7H4v-7zm9 0h7v7h-7v-7z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M4 4h7v7H4V4zm9 0h7v7h-7V4zm-9 9h7v7H4v-7zm9 0h7v7h-7v-7z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* 图片图标 */
.icon-image {
    background: linear-gradient(135deg, var(--success), var(--secondary-600));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ==========================================================================
   最终优化和兼容性
   ========================================================================== */

/* 确保所有图标在控制面板中正确显示 */
.control-panel .icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 高DPI屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .icon {
        -webkit-mask-size: contain;
        mask-size: contain;
    }
}

/* 打印样式优化 */
@media print {
    .max-imgcanvas-container {
        background: white !important;
        color: black !important;
    }
    
    .card, .control-panel {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    .btn {
        background: #f0f0f0 !important;
        color: black !important;
        border: 1px solid #ccc !important;
    }
}



/* 最终重置和清理 */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    position: relative;
    padding: 0;
    height: auto;
    font-family: var(--font-family-sans);
    line-height: var(--line-height-normal);
}

/* 确保所有交互元素都有适当的焦点样式 */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* 禁用文本选择（对于按钮等） */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* 平滑滚动 */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* 隐藏滚动条但保持滚动功能 */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* 最终CSS文件结束 */

/* 模板列表样式 */
#templates-list {
    flex-direction: column;
    gap: var(--space-3);
}

#templates-list > div {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    transition: all var(--transition-normal);
    border: 1px solid var(--gray-200);
}

#templates-list > div:hover {
    background: white;
    border-color: var(--primary-300);
    box-shadow: var(--shadow-sm);
}

#templates-list .flex.justify-between.items-center {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

#templates-list h4.font-medium {
    font-family: var(--font-family-sans);
    font-weight: var(--font-weight-medium);
    color: var(--gray-900);
    margin-bottom: var(--space-1);
    margin-top: var(--space-1);
    font-size: var(--font-size-base);
}

#templates-list p.text-xs.text-gray-500 {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    margin: 0;
}

#templates-list .flex.space-x-2 {
    display: flex;
    gap: var(--space-2);
}

#templates-list .load-template {
    background: var(--primary-50);
    color: var(--primary-600);
    border: 1px solid var(--primary-200);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

#templates-list .load-template:hover {
    background: var(--primary-100);
    border-color: var(--primary-300);
    color: var(--primary-700);
}

#templates-list .delete-template {
    background: var(--danger-50, #fef2f2);
    color: var(--danger, #ef4444);
    border: 1px solid var(--danger-200, #fee2e2);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

#templates-list .delete-template:hover {
    background: var(--danger-100, #fee2e2);
    border-color: var(--danger-300, #fca5a5);
    color: var(--danger-700, #b91c1c);
}

.alignment-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.alignment-inner {
    position: absolute;
    width: 100%;
    box-sizing: border-box;
}

/* 历史记录项样式 */
.history-item {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1/1;
    background-color: #f3f4f6;
}

.history-item:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-item .hover-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.history-item:hover .hover-overlay {
    background-color: rgba(0, 0, 0, 0.2);
    opacity: 1;
}

.history-item .action-buttons {
    display: flex;
    gap: 0.5rem;
}

.history-item .action-button {
    color: white;
    padding: 0.5rem;
    border-radius: 9999px;
    transition: all 0.2s ease;
}

.history-item .action-button.use-history {
    background-color: rgba(59, 130, 246, 0.8);
}

.history-item .action-button.use-history:hover {
    background-color: rgba(59, 130, 246, 1);
}

.history-item .action-button.download-history {
    background-color: rgba(0, 0, 0, 0.6);
}

.history-item .action-button.download-history:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* 预览区域固定定位样式 */
.bg-view-sticky {
    position: sticky;
    top: 80px;
    z-index: 10;
    align-self: flex-start;
}

