* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f0f4f8;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    /* 去除渐变改为纯色背景，符合 AdSense 设计规范 */
    background-color: #3498db;
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

header p {
    font-size: 0.95rem;
    opacity: 0.9;
}

main {
    padding: 1.5rem 0;
}

/* 主网格布局 */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.upload-section, .config-section, .result-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* 消息提示区域 */
.message-area {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideDown 0.3s ease-out;
}

.message-area.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-area.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.message-area.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.message-area svg {
    flex-shrink: 0;
}

.message-area .message-text {
    flex: 1;
    font-size: 0.9rem;
}

.message-area .message-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.message-area .message-close:hover {
    opacity: 1;
}

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

/* 上传区域 */
.upload-area {
    border: 2px dashed #3498db;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #f8fafc;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: #2980b9;
    background-color: #eef6fc;
}

.upload-area.dragover {
    border-color: #2980b9;
    background-color: #e3f2fd;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.upload-placeholder p {
    color: #555;
    font-size: 0.95rem;
}

.hint {
    font-size: 0.85rem !important;
    color: #888 !important;
}

/* 上传预览 */
.upload-preview {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-preview img {
    max-width: 100%;
    max-height: 180px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.change-photo-btn {
    background: #f0f4f8;
    color: #3498db;
    border: 1px solid #3498db;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s;
    width: auto;
}

.change-photo-btn:hover {
    background: #3498db;
    color: white;
}

/* 配置表单 */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

select {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: white;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.color-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.color-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: #f8fafc;
}

.color-option:hover {
    background-color: #eef6fc;
}

.color-option:has(input:checked) {
    border-color: #3498db;
    background-color: #eef6fc;
}

.color-option input {
    display: none;
}

.color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 0.5rem;
    border: 2px solid #ddd;
    flex-shrink: 0;
}

.color-preview.blue { background-color: #3498db; border-color: #2980b9; }
.color-preview.red { background-color: #e74c3c; border-color: #c0392b; }
.color-preview.white { background-color: #fff; border-color: #bbb; }
.color-preview.custom-color { background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1); border-color: #999; }
.color-preview.custom-color {
    background-color: #4a90e2;
    border-color: #999;
}

.custom-color-picker {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.8rem;
    padding: 0.8rem;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.custom-color-picker input[type="color"] {
    width: 45px;
    height: 35px;
    border: none;
    cursor: pointer;
    border-radius: 4px;
}

/* 按钮样式 */
button {
    /* 去除渐变，统一使用品牌主色 */
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-weight: 600;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f0f4f8;
    color: #3498db;
    border: 1px solid #3498db;
}

.btn-secondary:hover:not(:disabled) {
    background: #e3f2fd;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

/* 结果区域 */
.result-section {
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.result-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: #999;
    text-align: center;
}

.result-placeholder p {
    margin: 0;
}

.photo-preview {
    text-align: center;
    margin-bottom: 1.5rem;
}

.photo-preview img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    border: 1px solid #eee;
}

.result-actions {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: 350px;
}

.result-actions button {
    flex: 1;
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
}

/* 页脚 */
footer {
    background: #34495e;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .result-section {
        min-height: auto;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.4rem;
    }
    
    header p {
        font-size: 0.85rem;
    }
    
    .upload-section, .config-section, .result-section {
        padding: 1rem;
    }
    
    .upload-area {
        padding: 1.5rem;
        min-height: 160px;
    }
    
    .color-options {
        grid-template-columns: 1fr 1fr;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions button {
        width: 100%;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* 错误提示样式 */
.error-message {
    background-color: #fee2e2;
    color: #dc2626;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin: 1rem 0;
    text-align: center;
    font-size: 0.9rem;
    border: 1px solid #fecaca;
}


/* 友情链接样式 - 简单超文本 */
.friendlinks {
    background: #f8fafc;
    padding: 1rem 0;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.friendlinks .container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.friendlinks span {
    color: #666;
    font-size: 0.9rem;
}

.friendlinks a {
    color: #3498db;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.friendlinks a:hover {
    color: #2980b9;
    text-decoration: underline;
}
