* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', '微软雅黑', sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 88;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #5046e5;
}

.main-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    overflow: hidden;
    position: relative;
}

.controls {
    width: 300px;
    background-color: #fff;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    overflow-y: auto;
    height: calc(100vh - 60px);
    z-index: 20;
    transition: transform 0.3s ease;
}

.preview {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background-color: #f9f9f9;
    overflow: auto;
    height: calc(100vh - 60px);
    position: relative;
}

.preview-container {
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 80%;
    height: 80%;
}

.download-btn {
    background-color: #5046e5;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn:hover {
    background-color: #3c34b5;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group h3 {
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.control-group h3 button {
    background: none;
    border: none;
    color: #5046e5;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 0.3rem;
}

.btn {
    background-color: #5046e5;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.btn:hover {
    background-color: #3c34b5;
}

.btn-secondary {
    background-color: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background-color: #e0e0e0;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.color-layer {
    margin-bottom: 1rem;
    border-radius: 6px;
    background-color: #f8f8f8;
    border: 1px solid #eee;
    overflow: hidden;
}

.layer-header {
    display: flex;
    align-items: center;
    padding: 0.7rem;
    background-color: #f0f0f0;
    border-bottom: 1px solid #eee;
}

.layer-header .color-preview {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    margin-right: 0.5rem;
    border: 1px solid rgba(0,0,0,0.1);
}

.layer-header .layer-title {
    font-weight: 500;
    flex-grow: 1;
}

.layer-header .layer-actions {
    display: flex;
}

.layer-header button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.3rem;
    margin-left: 0.2rem;
}

.layer-header button:hover {
    color: #5046e5;
}

.layer-header button.delete-btn:hover {
    color: #ff4444;
}

.layer-content {
    padding: 0.7rem;
}

.control-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.7rem;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-row label {
    width: 60px;
    font-size: 0.85rem;
    color: #666;
}

.control-row .control-input {
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.control-row input[type="range"] {
    flex-grow: 1;
    margin-right: 0.5rem;
}

.control-row input[type="color"] {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 4px;
    background: none;
    padding: 0;
    cursor: pointer;
}

.control-row .value {
    font-size: 0.8rem;
    color: #666;
    width: 35px;
    text-align: right;
}

.add-color-btn {
    width: 100%;
    padding: 0.7rem;
    background-color: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    margin-top: 0.5rem;
    transition: background-color 0.2s;
}

.add-color-btn:hover {
    background-color: #e5e5e5;
}

.slider-control {
    width: 100%;
    margin-bottom: 0.7rem;
    display: flex;
    align-items: center;
}

.slider-control label {
    width: 60px;
    font-size: 0.85rem;
    color: #666;
}

.slider-control .slider-input {
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.slider-control input {
    flex-grow: 1;
    margin-right: 0.5rem;
}

.slider-control .value {
    font-size: 0.8rem;
    color: #666;
    width: 35px;
    text-align: right;
}

.active {
    background-color: #3c34b5;
}

.toggle-btn {
    display: flex;
    align-items: center;
    margin-bottom: 0.7rem;
}

.toggle-btn label {
    margin-left: 0.5rem;
    font-size: 0.85rem;
    color: #666;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #5046e5;
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* 下载模态框样式 */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    width: 400px;
    max-width: 90%;
    padding: 1.5rem;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.modal-backdrop.active .modal {
    transform: translateY(0);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-section {
    margin-bottom: 1.2rem;
}

.modal-section-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    margin-bottom: 0.5rem;
}

.resolution-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.resolution-option {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.resolution-option:hover {
    border-color: #5046e5;
    background-color: #f0f0f5;
}

.resolution-option.active {
    border-color: #5046e5;
    background-color: #5046e5;
    color: white;
}

.format-options {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.format-option {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.format-option:hover {
    border-color: #5046e5;
    background-color: #f0f0f5;
}

.format-option.active {
    border-color: #5046e5;
    background-color: #5046e5;
    color: white;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.modal-btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.modal-btn-primary {
    background-color: #5046e5;
    color: white;
    border: none;
}

.modal-btn-primary:hover {
    background-color: #3c34b5;
}

.modal-btn-secondary {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

.modal-btn-secondary:hover {
    background-color: #e0e0e0;
}

.copy-success {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4CAF50;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.copy-success.show {
    opacity: 1;
}

/* 移动端样式 */
.sidebar-toggle {
    display: none;
    position: fixed;
    left: 10px;
    bottom: 10px;
    background-color: #5046e5;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    z-index: 30;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 15;
    opacity: 0;
    transition: opacity 0.3s;
}

@media (max-width: 768px) {
    .controls {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: 280px;
        height: unset;
        z-index: 99;
    }
    
    .controls.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .sidebar-overlay {
        display: block;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
    }
    
    .preview {
        padding: 1rem;
    }
    
    .preview-container {
        width: 90%;
        height: 90%;
    }
}