/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 设置根元素字体大小，便于使用rem单位 */
html {
    font-size: 16px;
    /* 启用响应式字体大小，根据视口宽度调整 */
}

/* 移动设备响应式字体大小调整 */
@media (max-width: 48rem) { /* 768px */
    html {
        font-size: 15px;
    }
}

@media (max-width: 30rem) { /* 480px - 小型手机 */
    html {
        font-size: 14px;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1.25rem; /* 20px */
}

.container {
    max-width: 50rem; /* 800px */
    margin: 0 auto;
    background: white;
    border-radius: 1rem; /* 16px */
    box-shadow: 0 0.625rem 1.875rem rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 头部样式 */
header {
    text-align: center;
    padding: 2.5rem 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 12.5rem; /* 200px */
}

/* 历史记录按钮 */
.history-btn,
.back-btn {
    position: absolute;
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 0.125rem solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 3.125rem;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
}

.history-btn:hover,
.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 悬浮创作按钮样式 */
.floating-create-btn {
    position: absolute;
    right: 1.25rem;
    z-index: 1000;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 0.125rem solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    box-shadow: 0 0.25rem 0.625rem rgba(0, 0, 0, 0.15);
}

.floating-create-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
    box-shadow: 0 0.375rem 0.9375rem rgba(0, 0, 0, 0.2);
}

/* 悬浮按钮样式 */
.header-actions {
    position: absolute;
    right: 1.2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.floating-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 0.125rem solid rgba(255, 255, 255, 0.3);
    color: white;
    display: absolute;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}


/* 登录按钮样式 */
.login-header-btn {
    /* 基础样式已包含在floating-btn中 */
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.625rem;
}

.highlight {
    color: #ffd700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主体样式 */
main {
    border-radius: 1rem 1rem 0 0;
    padding: 1.875rem;
    background: white;
    margin-top: -1rem;
    position: relative;
    z-index: 1;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 1.875rem;
}

.upload-container {
    position: relative;
}

.upload-tip {
    text-align: center;
    margin-bottom: 0.9375rem;
    padding: 0.625rem;
    background-color: #f0f0ff;
    border-radius: 0.5rem;
    border-left: 0.25rem solid #667eea;
}

.upload-tip p {
    margin: 0;
    color: #667eea;
    font-size: 0.875rem;
    font-weight: 500;
}

.file-input {
    display: none;
}

.image-preview {
    margin-top: 1.25rem;
    position: relative;
    border-radius: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.1);
    background: #fafafa;
    min-height: 12.5rem;
    white-space: nowrap;
}

.preview-img {
    max-height: 25rem;
    height: auto;
    display: inline-block;
    object-fit: contain;
    margin: 0 auto;
}

.remove-btn {
    position: absolute;
    top: 0.3125rem;
    right: 0.3125rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    font-size: 0.9rem;
    color: #ff4757;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.15);
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

.remove-btn:hover {
    background: #ff4757;
    color: white;
    transform: scale(1.1);
}

/* 多图片上传相关样式 */
.image-previews {
    margin-top: 0;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.9375rem;
    transition: all 0.3s ease;
    justify-items: stretch;
    align-items: stretch;
}

.preview-grid.drag-over {
    background-color: #f0f0ff;
    border-radius: 8px;
    padding: 5px;
}

.preview-item {
    position: relative;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
    background: #fafafa;
    width: 100%;
    height: 12.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background-color: #f8f9fa;
}

.upload-button-item {
    position: relative;
    border: 0.125rem dashed #ddd;
    border-radius: 0.5rem;
    width: 100%;
    height: 12.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0.625rem;
    box-sizing: border-box;
    overflow: hidden;
}

.upload-button-item:hover {
    border-color: #667eea;
    background: #f0f0ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.upload-button-item i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.upload-button-item span {
    color: #667eea;
    font-size: 0.875rem;
    font-weight: 500;
}

/* 响应式调整 */
@media (max-width: 48rem) { /* 768px */
    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.625rem;
    }
    
    .preview-item,
    .upload-button-item {
        height: 9.375rem;
    }
    
    /* 选项展开按钮在平板上的响应式调整 */
    .options-toggle-section {
        margin-bottom: 1rem;
    }
    
    .options-toggle-btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    /* 比例选择器在平板上的响应式调整 */
    .aspect-ratio-section {
        margin-bottom: 1.5rem;
    }

    .aspect-ratio-options {
        gap: 0.625rem;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
    }

    .aspect-ratio-btn {
        flex-shrink: 0;
    }
    
    /* 分辨率选择在平板上的响应式调整 */
    .resolution-section {
        margin-top: 1.5rem;
    }
    
    .resolution-options {
        gap: 0.625rem;
        justify-content: flex-start;
    }
    
    .resolution-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        min-width: 4.5rem;
    }

    /* 调整结果区域在平板上的显示 */
    .result-section {
        margin-bottom: 1.5rem;
    }

    .result-container {
        min-height: 18.75rem;
    }
    
    /* 输入区域响应式调整 */
    .text-section {
        margin-bottom: 1.5rem;
    }
    
    #text-input {
        min-height: 10rem;
        padding: 0.75rem 0.875rem;
        font-size: 0.9rem;
    }
}

/* 媒体查询 - 小型手机输入区域调整 */
@media (max-width: 30rem) {
    /* 选项展开按钮在小型手机上的响应式调整 */
    .options-toggle-section {
        margin-bottom: 0.9375rem;
    }
    
    .options-toggle-btn {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }
    
    /* 比例选择器在手机上的响应式调整 */
    .aspect-ratio-section {
        margin-bottom: 1.25rem;
    }

    .aspect-ratio-options {
        gap: 0.5rem;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
    }

    .aspect-ratio-btn {
        min-width: 2.25rem;
        height: 3rem;
        font-size: 0.7rem;
    }
    
    /* 分辨率选择在小型手机上的响应式调整 */
    .resolution-section {
        margin-top: 1.25rem;
    }
    
    .resolution-options {
        gap: 0.5rem;
        justify-content: flex-start;
    }
    
    .resolution-btn {
        padding: 0.4375rem 0.875rem;
        font-size: 0.85rem;
        min-width: 4rem;
    }

    /* 调整结果区域在手机上的显示 */
    .result-section {
        margin-bottom: 1.25rem;
    }

    .result-container {
        min-height: 15.625rem;
    }

    .result-title {
        font-size: 1.3rem;
        margin-bottom: 1rem;
    }
    
    /* 输入区域响应式调整 */
    .text-section {
        margin-bottom: 1.25rem;
    }
    
    #text-input {
        min-height: 8.75rem;
        padding: 0.625rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* 超小型手机优化 */
@media (max-width: 20rem) {
    .container {
        padding: 0.5rem;
        width: calc(100% - 1rem);
    }

    header {
        padding: 1rem 0.75rem;
    }

    .title {
        font-size: 1.3rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    main {
        padding: 1rem 0.75rem;
    }
    
    /* 选项展开按钮在超小型手机上的响应式调整 */
    .options-toggle-section {
        margin-bottom: 0.875rem;
    }
    
    .options-toggle-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    #text-input {
        min-height: 7.5rem;
        font-size: 0.8rem;
    }

    /* 比例选择器在超小型手机上的响应式调整 */
    .aspect-ratio-section {
        padding: 0 0.75rem 1rem 0.75rem;
    }
    
    .aspect-ratio-btn {
        min-width: 2rem;
        height: 2.75rem;
        font-size: 0.65rem;
    }
    
    /* 分辨率选择在超小型手机上的响应式调整 */
    .resolution-section {
        margin-top: 1rem;
        padding: 0 0.75rem 1rem 0.75rem;
    }
    
    .resolution-options {
        gap: 0.4375rem;
        flex-wrap: wrap;
    }
    
    .resolution-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
        min-width: 3.5rem;
    }

    .result-container {
        min-height: 12.5rem;
    }

    .action-section {
        margin-bottom: 1.25rem;
    }
}

/* 选项展开按钮区域 */
.options-toggle-section {
    margin-bottom: 1.25rem;
}

.options-toggle-btn {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.625rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 1rem;
    color: #495057;
}

.options-toggle-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-icon.rotated {
    transform: rotate(180deg);
}

/* 高级选项容器 */
.advanced-options {
    margin-bottom: 1.875rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-0.625rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.advanced-options.hidden {
    display: none;
}

/* 文字输入区域 */
.text-section {
    margin-bottom: 1.875rem;
}

/* 比例选择器样式 */
.aspect-ratio-section {
    padding: 0 1.25rem 1.25rem 1.25rem;
}

.aspect-ratio-label {
    display: block;
    margin-bottom: 0.9375rem;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.aspect-ratio-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.aspect-ratio-btn {
    background: #f8f9fa;
    border: 0.125rem solid #e2e8f0;
    color: #4a5568;
    padding: 0.1875rem 0.3125rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3125rem;
    transition: all 0.2s ease;
    min-width: 3.7125rem;
    height: 4.25rem;
    justify-content: center;
}

/* 自动按钮特殊样式 */
.aspect-ratio-btn[data-ratio="auto"] .text-container {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* 所有按钮文字容器样式 */
.aspect-ratio-btn .text-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 1.125rem;
    line-height: 1;
}

/* 自动按钮特殊样式 */
.aspect-ratio-btn[data-ratio="auto"] .text-container i {
    font-size: 0.7rem;
    margin-right: 0.125rem;
}

/* 比例预览框样式 */
.ratio-preview {
    border: 0.09375rem solid currentColor;
    border-radius: 0.1875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* 各种比例的宽高比设置 */
.ratio-auto {
    width: 1.75rem;
    height: 1.75rem;
    background-color: rgba(0, 0, 0, 0.05);
}

.ratio-16-9 {
    width: 1.625rem;
    height: 0.9375rem;
    background-color: rgba(0, 0, 0, 0.05);
}

.ratio-9-16 {
    width: 0.9375rem;
    height: 1.625rem;
    background-color: rgba(0, 0, 0, 0.05);
}

.ratio-4-3 {
    width: 1.625rem;
    height: 1.21875rem;
    background-color: rgba(0, 0, 0, 0.05);
}

.ratio-3-4 {
    width: 1.21875rem;
    height: 1.625rem;
    background-color: rgba(0, 0, 0, 0.05);
}

/* 选中状态下的预览框样式 */
.aspect-ratio-btn.active .ratio-preview {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: white;
}

.aspect-ratio-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.aspect-ratio-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* 分辨率选择样式 */
.resolution-section {
    margin-top: 1.875rem;
    padding: 0 1.25rem 1.25rem 1.25rem;
}

.resolution-label {
    display: block;
    margin-bottom: 0.9375rem;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.resolution-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.resolution-btn {
    padding: 0.625rem 1.25rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: #495057;
    transition: all 0.2s ease;
    min-width: 5rem;
}

.resolution-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.resolution-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
    font-weight: 500;
}

.text-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.625rem;
}

#text-input {
    width: 100%;
    padding: 0.9375rem;
    border: 0.125rem solid #ddd;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 12.5rem;
    transition: border-color 0.3s ease;
    line-height: 1.6;
}

#text-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 0.1875rem rgba(102, 126, 234, 0.1);
}

.char-count {
    text-align: right;
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

/* 操作按钮 */
.action-section {
    margin-bottom: 1.875rem;
    text-align: center;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.9375rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 3.125rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 12.5rem;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loading {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* 结果区域 */
.result-section {
    text-align: center;
}

.result-title {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 1.25rem;
}

.result-container {
    margin-bottom: 1.875rem;
    border-radius: 0.75rem;
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.1);
    padding: 0.625rem;
    background: #fafafa;
    min-height: 12.5rem;
    white-space: nowrap;
}

#result-img {
    max-height: 31.25rem;
    height: auto;
    display: inline-block;
    object-fit: contain;
    margin: 0 auto;
}

.download-btn,
.new-btn {
    margin: 0 0.625rem;
    border: none;
    border-radius: 3.125rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-btn {
    background: #2ed573;
    color: white;
}

.download-btn:hover {
    background: #26c268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 213, 115, 0.3);
}

.new-btn {
    background: #ff6348;
    color: white;
}

.new-btn:hover {
    background: #ff4757;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 99, 72, 0.3);
}

/* 底部样式 */
footer {
    text-align: center;
    padding: 1.25rem;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9rem;
}

/* 提示信息样式 */
#toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.375rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#toast.show {
    opacity: 1;
}



/* 动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 历史记录页面样式 */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18.75rem, 1fr));
    gap: 1.25rem;
    width: 100%;
}

.history-item {
    background: #f8f9fa;
    border-radius: 0.75rem;
    overflow: hidden;
    height: 22.5rem;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

.history-item:hover {
    /* 移除动画效果 */
}

.history-image {
    width: 100%;
    height: 22.5rem;
    object-fit: cover;
    display: block;
}

.history-content {
    padding: 0.9375rem;
}

.history-time {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 0.625rem;
}

.history-text {
    color: #333;
    line-height: 1.5;
    margin-bottom: 0.9375rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-actions {
    display: flex;
    gap: 0.625rem;
    flex-wrap: wrap;
}

/* 响应式按钮样式 */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1;
    min-width: 6rem;
    text-align: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: #e2e8f0;
    color: #333;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

.empty-state {
    text-align: center;
    padding: 3.75rem 1.25rem;
    background: #f8f9fa;
    border-radius: 1rem;
    box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    max-width: 30rem;
}

.empty-icon {
    font-size: 3rem;
    color: #cbd5e0;
    margin-bottom: 1.25rem;
}

.empty-text {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

/* 工具类 */
.hidden {
    display: none;
}

/* 响应式设计 */
@media (max-width: 48rem) {
    .container {
        border-radius: 0.75rem;
        overflow: hidden;
        margin: 0 auto;
        width: 100%;
        max-width: 100%;
    }

    header {
        padding: 1.875rem 1.25rem;
        flex-direction: column;
    }

    .title {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    main {
        border-radius: 0.625rem 0.625rem 0 0;
        padding: 1.25rem;
        overflow-x: hidden;
    }

    .text-label {
        font-size: 1rem;
    }

    .result-title {
        font-size: 1.5rem;
    }

    .submit-btn {
        font-size: 1.1rem;
        min-width: 10rem;
        width: 100%;
    }

    /* 调整历史记录页面在平板上的布局 */
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
        gap: 1rem;
    }

    .history-item {
        margin: 0 auto;
        height: auto;
        width: 100%;
    }

    /* 优化按钮在平板上的布局 */
    .download-btn,
    .new-btn {
        width: calc(50% - 0.3125rem);
        margin: 0rem 0.15625rem;
    }

    .action-section {
        margin-bottom: 1.5rem;
    }
}

/* 小型手机优化 */
@media (max-width: 30rem) {
    .title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.9rem;
        text-align: center;
    }

    .history-btn,
    .back-btn {
        position: static;
        transform: none;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        width: fit-content;
    }

    header {
        padding: 1.25rem 1rem;
        flex-direction: column;
        min-height: auto;
    }

    main {
        padding: 1rem;
    }

    .submit-btn {
        font-size: 1rem;
        padding: 0.75rem 2rem;
        min-width: 9rem;
        width: 100%;
    }

    .download-btn,
    .new-btn {
        font-size: 0.9rem;
        margin: 0rem 0;
        width: 100%;
    }

    .aspect-ratio-btn {
        min-width: 3.0rem;
        height: 3.75rem;
        font-size: 0.75rem;
    }

    .aspect-ratio-options {
        justify-content: left;
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    /* 历史记录页面在手机上的布局 */
    .history-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .history-item {
        max-width: 100%;
    }

    .history-image {
        height: auto;
    }

    /* 空状态在手机上的调整 */
    .empty-state {
        padding: 2.5rem 1rem;
        margin: 0 auto;
    }

    .empty-icon {
        font-size: 2.5rem;
    }

    .empty-text {
        font-size: 1rem;
    }

    /* 调整按钮在手机上的布局 */
    .history-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    /* 优化图片预览区域在手机上的显示 */
    .preview-item,
    .upload-button-item,
    .image-preview {
        height: 10rem;
    }
} 

/* 自定义确认对话框样式 */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* 提高z-index确保在所有元素之上 */
    animation: fadeIn 0.3s ease-out;
    /* 确保在各种屏幕尺寸下都能正确显示 */
    width: 100vw;
    height: 100vh;
    pointer-events: auto;
}

/* 提高hidden类的优先级 */
.custom-confirm-overlay.hidden {
    display: none !important;
}

.custom-confirm-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 400px;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
}

.custom-confirm-header {
    padding: 20px 24px 0;
    text-align: center;
}

.custom-confirm-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.custom-confirm-content {
    padding: 24px;
    text-align: center;
}

.confirm-message {
    font-size: 1rem;
    color: #4b5563;
    margin: 0;
    line-height: 1.5;
}

.custom-confirm-footer {
    padding: 0 24px 24px;
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-direction: row;
}

.confirm-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.cancel-btn {
    background-color: #f3f4f6;
    color: #4b5563;
}

.cancel-btn:hover {
    background-color: #e5e7eb;
}

.ok-btn {
    background-color: #4f46e5;
    color: white;
}

.ok-btn:hover {
    background-color: #4338ca;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 响应式设计 */
@media (max-width: 48rem) {
    .custom-confirm-dialog {
        width: 90%;
        margin: 0 10px;
    }
    
    /* 保持按钮左右排列 */
    .custom-confirm-footer {
        flex-direction: row;
        gap: 10px;
    }
    
    .confirm-btn {
        width: 100%;
    }
}

@media (max-width: 30rem) {
    .custom-confirm-dialog {
        width: 95%;
    }
    
    .custom-confirm-header {
        padding: 16px 20px 0;
    }
    
    .custom-confirm-title {
        font-size: 1.1rem;
    }
    
    .custom-confirm-content {
        padding: 20px;
    }
    
    .confirm-message {
        font-size: 0.95rem;
    }
    
    .custom-confirm-footer {
        padding: 0 20px 20px;
    }
}

/* 大屏样式优化 */
@media (min-width: 48rem) {
    .custom-confirm-overlay {
        z-index: 9999;
        background-color: rgba(0, 0, 0, 0.6); /* 大屏下背景更暗 */
    }
    
    .custom-confirm-dialog {
        max-width: 500px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15); /* 大屏下阴影更大 */
        border-radius: 16px; /* 大屏下圆角更大 */
    }
}