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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(270deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

.converter-section, .preview-section, .multi-canvas-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.upload-area h2, .conversion-options h2, .preview-section h2, .multi-canvas-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.file-drop {
    border: 3px dashed #cbd5e0;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.file-drop:hover {
    border-color: #667eea;
    background-color: #f7fafc;
}

.file-drop.dragover {
    border-color: #667eea;
    background-color: #ebf8ff;
}

.file-drop input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-drop p {
    font-size: 1.1rem;
    color: #718096;
    margin: 0;
}

.conversion-options {
    display: grid;
    gap: 20px;
}

.canvas-type-selector, .metadata-editor, .output-options {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.metadata-editor h3, .output-options h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #495057;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #6c757d;
    font-size: 12px;
    font-style: italic;
}

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

.convert-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    margin-top: 20px;
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.convert-btn:active {
    transform: translateY(0);
}

.convert-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.preview-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

#previewCanvas {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.preview-info {
    flex: 1;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    word-wrap: anywhere;
    overflow-wrap: anywhere;
    min-width: 0;
}

.preview-info h3 {
    margin-bottom: 15px;
    color: #495057;
}

.preview-info p {
    margin-bottom: 8px;
    color: #6c757d;
}

.preview-info strong {
    color: #495057;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    margin: 20px 0;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
    margin: 20px 0;
}

.multi-canvas-options {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.grid-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 15px 0;
}

.resolution-info {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #2196f3;
}

.resolution-info p {
    margin: 5px 0;
    color: #1565c0;
}

.grid-preview {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 20px;
}

.grid-container {
    display: grid;
    gap: 1px;
    margin: 0 auto;
    background: #dee2e6;
    padding: 5px;
    border-radius: 4px;
    width: fit-content;
    height: fit-content;
}

.grid-cell {
    background: #fff;
    border: 1px solid #adb5bd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #6c757d;
    min-height: 20px;
    position: relative;
    overflow: hidden;
}

.grid-cell canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

@media (max-width: 768px) {
    .grid-controls {
        grid-template-columns: 1fr;
    }
}
.usage-guide {
    background: #f8f9fa;
    padding: 40px 0;
    margin-top: 40px;
}

.usage-guide h2 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 2rem;
}

.guide-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.guide-section h3 {
    color: #495057;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.guide-section h4 {
    color: #6c757d;
    font-size: 1.1rem;
}

.command-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    color: #1565c0;
}

.command-box p {
    color: #1565c0;
    margin: 5px 0;
}

.command-box code {
    background: #1976d2 !important;
    color: white !important;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    border: none !important;
}

.workflow {
    background: #f1f8e9;
    border-left: 4px solid #4caf50;
    padding: 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.workflow ol {
    margin: 10px 0 0 20px;
}

.workflow li {
    margin: 8px 0;
    line-height: 1.5;
}

.guide-section ul {
    margin: 15px 0 0 20px;
}

.guide-section li {
    margin: 8px 0;
    line-height: 1.5;
}

.guide-section code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    border: 1px solid #e9ecef;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .converter-section, .preview-section, .multi-canvas-section {
        padding: 20px;
    }
    
    .preview-container {
        flex-direction: column;
    }
    
    .grid-controls {
        grid-template-columns: 1fr;
    }
    
    .usage-guide {
        padding: 20px 0;
    }
    
    .guide-section {
        padding: 20px;
        margin-bottom: 20px;
    }
}
