/* ===== 基础样式 ===== */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* iOS 消除点击高亮 */
}

body {
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    -webkit-touch-callout: none; /* iOS 禁止长按弹出菜单 */
    -webkit-user-select: none; /* iOS 禁止文本选择 */
    user-select: none;
}

/* iOS 点击优化：所有可点击元素添加 cursor */
button, .tab-btn, .color-box, .drop-area, .upload-zone, .layout-template, 
.orientation-btn, .dpi-preset, .scheme-btn, .secondary-btn, .primary-btn {
    cursor: pointer;
    touch-action: manipulation; /* iOS 优化触摸响应 */
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

/* 返回主页链接 */
.back-link {
    display: inline-block;
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    margin-bottom: 15px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    transition: all 0.3s;
}
.back-link:hover {
    background: rgba(255,255,255,0.25);
    transform: translateX(-3px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.98);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.2em;
}

h3 {
    color: #555;
    margin: 20px 0 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #eee;
}

.tool-intro {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* ===== 标签页样式 ===== */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
    gap: 5px;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    color: #666;
    transition: all 0.3s;
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
    /* iOS 修复 */
    -webkit-appearance: none;
    touch-action: manipulation;
    pointer-events: auto;
}

.tab-btn:hover {
    color: #667eea;
    background: #f8f9fa;
}

/* 移动端标签页优化 */
@media (max-width: 768px) {
    .tabs {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 5px;
    }
    
    .tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab-btn {
        padding: 10px 16px;
        font-size: 14px;
        flex-shrink: 0;
        /* iOS 修复 */
        -webkit-appearance: none;
        touch-action: manipulation;
        pointer-events: auto;
    }
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: bold;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 拖放区域样式 ===== */
#drop-area,
.drop-area {
    border: 3px dashed #ccc;
    border-radius: 12px;
    padding: 50px 20px;
    text-align: center;
    margin: 20px 0;
    transition: all 0.3s;
    cursor: pointer;
    background: #fafafa;
}

#drop-area:hover,
.drop-area:hover {
    border-color: #667eea;
    background: #f5f7ff;
}

#drop-area.highlight,
.drop-area.highlight {
    border-color: #667eea;
    background: linear-gradient(135deg, #f5f7ff 0%, #e8ecff 100%);
    transform: scale(1.02);
}

#drop-area p,
.drop-area p {
    font-size: 1.1em;
    color: #666;
    margin: 0;
}

input[type="file"] {
    display: none;
}

/* ===== 控制区域样式 ===== */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 25px 0;
    flex-wrap: wrap;
}

.controls label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

input[type="range"] {
    width: 150px;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

input[type="number"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 100px;
    font-size: 14px;
}

select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
}

button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== 预览区域 ===== */
#preview-container,
#process-preview,
#convert-preview {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.image-box,
.process-box,
.convert-box {
    flex: 1;
    min-width: 280px;
    text-align: center;
}

.image-box img,
.process-box img,
.convert-box img {
    max-width: 100%;
    max-height: 350px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: none;
}

.empty-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 200px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    color: #999;
    font-size: 16px;
}

.file-info {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
}

.download-btn {
    display: block;
    margin: 25px auto;
    padding: 14px 32px;
    font-size: 16px;
}

/* ===== 颜色提取样式 ===== */
#color-palette {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

#color-palette h3 {
    text-align: center;
    margin-bottom: 20px;
    border: none;
}

.colors-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.color-box {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding-bottom: 5px;
    overflow: hidden;
}

.color-box:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* 选中状态 */
.color-box.active {
    border: 3px solid #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4), 0 8px 25px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

/* 颜色详情 - 值行和复制按钮 */
.color-value-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.color-value-row:last-child {
    border-bottom: none;
}

.color-value-row span {
    font-family: monospace;
    font-size: 12px;
}

.copy-btn {
    background: rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(102, 126, 234, 0.4);
    color: #667eea;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #667eea;
    color: white;
}

.color-box .color-name,
.color-box .color-hex {
    display: block;
    font-size: 11px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color: white;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 8px;
    border-radius: 10px;
    margin: 1px 0;
    backdrop-filter: blur(2px);
}

/* 配色方案样式 */
#color-schemes {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

#color-schemes h3 {
    text-align: center;
    margin-bottom: 15px;
    border: none;
}

.scheme-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.scheme-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    color: #666;
    font-size: 13px;
    box-shadow: none;
}

.scheme-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.scheme-btn:hover:not(.active) {
    background: #e0e0e0;
}

/* 颜色详情样式 */
#color-details {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

#color-details h3 {
    text-align: center;
    margin-bottom: 20px;
    border: none;
}

.detail-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.detail-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s;
}

.detail-card:hover {
    transform: translateY(-3px);
}

.card-color {
    height: 80px;
}

.card-info {
    padding: 12px;
}

.card-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.card-values {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
}

/* 导出按钮区域 */
.export-section {
    margin-top: 30px;
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.export-section button {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
}

.export-section button:hover {
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.5);
}

/* ===== 图片处理功能样式 ===== */
.process-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-radius: 16px;
    border: 1px solid #e0e8ff;
}

.panel-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.panel-section h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.control-row label {
    min-width: 100px;
    font-weight: 500;
    color: #555;
}

.control-row select {
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    min-width: 180px;
    background: white;
}

.control-row select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 滑块+输入框组合 */
.slider-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.slider-input-group input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #e0e8ff;
    border-radius: 3px;
    outline: none;
}

.slider-input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

.slider-input-group input[type="number"] {
    width: 70px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: center;
}

.slider-input-group .unit {
    color: #888;
    font-size: 13px;
    min-width: 35px;
}

.small-input {
    width: 60px !important;
    padding: 8px 10px !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    text-align: center;
}

/* DPI 预设按钮 */
.dpi-presets {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
}

.dpi-preset {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.dpi-preset:hover {
    border-color: #667eea;
    color: #667eea;
}

.dpi-preset.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* 像素显示 */
.pixel-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin: 15px 0;
    text-align: center;
}

.pixel-display span {
    font-weight: bold;
    font-family: monospace;
    font-size: 16px;
}

/* 自定义尺寸输入 */
.size-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mm-input {
    width: 80px !important;
    padding: 10px 12px !important;
}

/* 方向切换 */
.orientation-row {
    margin-top: 10px;
}

.orientation-toggle {
    display: flex;
    gap: 8px;
}

.orientation-btn {
    padding: 10px 20px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.orientation-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.orientation-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

/* 输出面板 */
.output-panel .process-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.output-panel .process-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.checkbox-row {
    margin-top: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ===== 打印排版样式 ===== */
.layout-section {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
}

.layout-section h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #333;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
}

/* 排版配置（模板+设置合并） */
.layout-config {
    padding: 12px 15px;
}

.layout-config .layout-templates {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.layout-templates.compact .layout-template {
    padding: 5px 8px;
    min-width: auto;
    flex: 1;
    min-width: 55px;
    max-width: 80px;
}

.layout-template {
    padding: 10px 12px;
    border: 2px solid #eee;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
    text-align: center;
}

.layout-template:hover {
    border-color: #667eea;
}

.layout-template.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.template-name {
    font-weight: 600;
    font-size: 12px;
    color: #333;
    display: block;
}

.template-desc {
    font-size: 10px;
    color: #888;
    display: block;
    margin-top: 2px;
}

/* 排版设置网格 */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.settings-grid .control-row label {
    min-width: 40px;
    font-size: 12px;
}

.settings-grid .control-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.settings-grid .control-row.full-width {
    grid-column: 1 / -1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
}

/* 多图上传区域 */
.multi-upload {
    border: 2px dashed #667eea;
    background: rgba(102, 126, 234, 0.05);
}

/* 已添加图片列表 */
.layout-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.layout-image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #eee;
}

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

.layout-image-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(255, 59, 48, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.layout-actions {
    margin-top: 15px;
}

.secondary-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
}

.secondary-btn:hover {
    background: #f5f5f5;
}

/* 底部并排布局：添加图片 + 预览 */
.layout-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
}

.add-images-section {
    margin-bottom: 0;
}

.add-images-section .multi-upload {
    padding: 15px;
    min-height: 80px;
}

.add-images-section .multi-upload p {
    font-size: 13px;
    margin: 0;
}

.add-images-section .layout-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    margin-top: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.add-images-section .layout-image-item {
    aspect-ratio: 1;
    border-radius: 6px;
}

.add-images-section .layout-image-item .remove-btn {
    width: 16px;
    height: 16px;
    font-size: 10px;
}

.layout-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.image-count {
    font-size: 12px;
    color: #888;
}

/* 预览区域（缩小） */
.preview-section {
    margin-bottom: 0;
    min-height: 0;
}

#layout-canvas-container {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 150px;
    max-height: 250px;
}

#layout-canvas {
    max-width: 100%;
    max-height: 200px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.layout-actions-bottom {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.primary-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* ===== Toast 提示 ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

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

/* ===== 响应式样式 ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
        border-radius: 12px;
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    
    .back-link {
        font-size: 14px;
        padding: 6px 12px;
        margin-bottom: 10px;
    }

    .tabs {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 8px;
        padding: 5px 0;
        margin-bottom: 20px;
    }
    
    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        padding: 10px 16px;
        font-size: 13px;
        flex-shrink: 0;
        white-space: nowrap;
        border-radius: 20px;
        border: 2px solid transparent;
    }

    /* 图片处理面板响应式 */
    .process-panel {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }

    .panel-section {
        padding: 15px;
    }

    .control-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .control-row label {
        min-width: auto;
    }

    .slider-input-group {
        width: 100%;
    }

    .dpi-presets {
        flex-wrap: wrap;
    }

    /* 打印排版响应式 */
    .layout-settings {
        grid-template-columns: 1fr;
    }

    /* 打印排版移动端适配 */
    .layout-config {
        padding: 10px 12px;
    }

    .layout-config .layout-templates {
        gap: 4px;
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    .layout-templates.compact .layout-template {
        padding: 4px 6px;
        min-width: 50px;
    }

    .template-name {
        font-size: 11px;
    }

    .template-desc {
        font-size: 9px;
    }

    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .settings-grid .control-row {
        font-size: 12px;
    }

    .settings-grid .control-row.full-width {
        grid-column: span 2;
    }

    .layout-bottom-row {
        grid-template-columns: 1fr;
    }

    .add-images-section .layout-images {
        max-height: 100px;
    }

    #layout-canvas-container {
        min-height: 120px;
        max-height: 180px;
    }

    #layout-canvas {
        max-height: 150px;
    }

    .layout-templates {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tab-btn.active {
        border: 2px solid #667eea;
        background: rgba(102, 126, 234, 0.1);
    }

    #preview-container,
    #process-preview,
    #convert-preview {
        flex-direction: column;
    }

    .image-box,
    .process-box,
    .convert-box {
        width: 100%;
    }
    
    .tool-intro {
        padding: 12px;
        font-size: 14px;
    }
    
    .tool-intro p {
        margin: 5px 0;
    }

    .color-box {
        width: 60px;
        height: 60px;
    }

    .controls,
    .process-controls,
    .convert-controls {
        flex-direction: column;
    }

    .export-section {
        flex-direction: column;
    }

    .export-section button {
        width: 100%;
    }

    .detail-cards {
        grid-template-columns: 1fr;
    }
    
    /* HEIC 转换器移动端优化 */
    #heic-drop-area {
        padding: 30px 15px;
    }
    
    #heic-drop-area p {
        font-size: 14px;
    }
    
    #heic-file-list .file-item {
        padding: 10px;
        font-size: 13px;
    }
    
    .format-select label {
        font-size: 14px;
    }
}

/* ===== HEIC 下载按钮样式 ===== */
.heic-download-notice {
    background: linear-gradient(135deg, #fff9e6 0%, #fff5d6 100%);
    border: 2px solid #ffd700;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    text-align: center;
}

.heic-download-notice .notice-title {
    color: #e74c3c;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 10px;
}

.heic-download-notice .download-title {
    color: #667eea;
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 15px;
}

.download-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.download-btn-exe,
.download-btn-py {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
    min-width: 140px;
}

.download-btn-exe {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.download-btn-exe:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.download-btn-py {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.download-btn-py:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.download-buttons .btn-icon {
    font-size: 28px;
    margin-bottom: 5px;
}

.download-buttons .btn-text {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 3px;
}

.download-buttons .btn-size {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 3px;
}

.download-buttons .btn-desc {
    font-size: 11px;
    opacity: 0.8;
}

/* 移动端下载按钮适配 */
@media (max-width: 768px) {
    .download-buttons {
        flex-direction: column;
    }
    
    .download-btn-exe,
    .download-btn-py {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 12px 20px;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .download-buttons .btn-icon {
        font-size: 24px;
        margin-bottom: 0;
    }
    
    .download-buttons .btn-text {
        font-size: 14px;
        margin-bottom: 0;
    }
    
    .download-buttons .btn-size {
        margin-left: auto;
        margin-bottom: 0;
    }
    
    .download-buttons .btn-desc {
        display: none;
    }
}