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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 15px;
    transform: scale(0.9);
    transform-origin: center;
}

h1 {
    text-align: center;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.8rem;
}

.preview-section h1 {
    margin-top: 0;
    margin-bottom: 5px;
}

.site-description {
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.upload-section {
    text-align: center;
    margin-bottom: 20px;
}

.upload-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.upload-hint {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

.upload-label {
    display: inline-block;
    padding: 12px 24px;
    background-color: #3498db;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-weight: 500;
}

.upload-label:hover {
    background-color: #2980b9;
}

#imageUpload {
    display: none;
}

.editor-section {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.controls {
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.control-group input[type="text"],
.control-group select,
.control-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

.control-group textarea {
    resize: vertical;
    font-family: inherit;
}

.control-group input[type="range"] {
    width: 70%;
    vertical-align: middle;
}

.color-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.control-group input[type="color"] {
    width: 50px;
    height: 35px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.color-input-group input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: monospace;
}

.control-group input[type="checkbox"] {
    margin-right: 8px;
}

.control-group small {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 12px;
}

.preview-section {
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 350px;
    position: relative;
}

.canvas-container {
    position: relative;
    width: 100%;
    max-width: 720px;
    aspect-ratio: 1280 / 670;
    border: 1px solid #e0e0e0;
    background-color: #f5f5f5;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    user-select: none;
}

#noImageMessage {
    position: absolute;
    color: #999;
    font-size: 18px;
    pointer-events: none;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px auto 0;
}

.download-btn, .copy-image-btn, .copy-url-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.download-btn {
    background-color: #27ae60;
    color: white;
}

.download-btn:hover:not(:disabled) {
    background-color: #229954;
}

.download-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.copy-image-btn {
    background-color: #f39c12;
    color: white;
}

.copy-image-btn:hover:not(:disabled) {
    background-color: #e67e22;
}

.copy-image-btn:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.copy-image-btn.copied {
    background-color: #27ae60;
}

.copy-url-btn {
    background-color: #3498db;
    color: white;
}

.copy-url-btn:hover {
    background-color: #2980b9;
}

.copy-url-btn.copied {
    background-color: #27ae60;
}

.clear-btn {
    padding: 12px 24px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s;
}

.clear-btn:hover {
    background-color: #c0392b;
}

.custom-size-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.custom-size-inputs span {
    color: #666;
    font-weight: 500;
}


.control-group {
    position: relative;
}

.eyedropper-btn {
    padding: 6px 8px;
    background-color: #17a2b8;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
    margin-left: 4px;
}

.eyedropper-btn:hover {
    background-color: #138496;
}

.eyedropper-btn.active {
    background-color: #28a745;
}

.canvas-eyedropper {
    cursor: crosshair !important;
}

.history-section {
    background-color: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.history-section h2 {
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 1.1rem;
}

.history-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
}

.history-item {
    position: relative;
    min-width: 120px;
    max-width: 150px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.history-item:hover {
    border-color: #3498db;
    background-color: #e8f4f8;
}

.history-item-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
}

.history-item-details {
    font-size: 12px;
    color: #666;
}

.history-item-date {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

.history-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.history-item:hover .history-delete-btn {
    display: flex;
}

.history-delete-btn:hover {
    background-color: #c0392b;
}

.history-list::-webkit-scrollbar {
    height: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

@media (max-width: 768px) {
    .editor-section {
        grid-template-columns: 1fr;
    }
    
    .controls {
        order: 2;
    }
    
    .preview-section {
        order: 1;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
    
    .download-btn, .copy-image-btn, .copy-url-btn {
        width: 180px;
    }
}