body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 30px;
}

.info {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #2196f3;
}

.drop-zone {
    border: 3px dashed #cbd5e0;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 20px;
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: #4299e1;
    background: #ebf8ff;
    transform: translateY(-2px);
}

.drop-zone p {
    margin: 0;
    font-size: 18px;
    color: #718096;
}

.file-input {
    display: none;
}

.preview-section {
    margin: 20px 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    display: none;
}

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

.preview-item {
    text-align: center;
}

.preview-item h4 {
    margin: 0 0 10px 0;
    color: #4a5568;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    image-rendering: pixelated;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    background: linear-gradient(45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(-45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f1f1f1 75%), 
                linear-gradient(-45deg, transparent 75%, #f1f1f1 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.interpreted-canvas {
    max-width: 200px;
    max-height: 200px;
    image-rendering: pixelated;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    background: linear-gradient(45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(-45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f1f1f1 75%), 
                linear-gradient(-45deg, transparent 75%, #f1f1f1 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Updated main output section styles */
.main-output-section {
    margin: 20px 0;
    text-align: center;
    display: none;
}

.pxt-output {
    background: #2d3748;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 10px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.copy-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    margin: 20px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.copy-btn:hover {
    background: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(66, 153, 225, 0.4);
}

.copy-btn:active {
    background: #2c5282;
    transform: translateY(0);
}

.scale-controls {
    background: #f0f7ff;
    border: 1px solid #bee3f8;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    display: none;
}

.scale-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.scale-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.scale-input-group label {
    font-weight: bold;
    color: #2d3748;
    font-size: 14px;
}

.scale-input {
    width: 80px;
    padding: 8px;
    border: 2px solid #cbd5e0;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
}

.scale-input:focus {
    outline: none;
    border-color: #4299e1;
}

.lock-btn {
    background: #68d391;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 20px;
    transition: background 0.3s ease;
}

.lock-btn.locked {
    background: #f56565;
}

.lock-btn:hover {
    background: #48bb78;
}

.lock-btn.locked:hover {
    background: #e53e3e;
}

.scale-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    height: fit-content;
    margin-top: 20px;
}

.scale-btn:hover {
    background: #3182ce;
}

.spritesheet-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.spritesheet-btn {
    background: #38a169;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s ease;
    margin-right: 10px;
}

.spritesheet-btn:hover {
    background: #2f855a;
}

.spritesheet-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

.spritesheet-section {
    margin: 20px 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    display: none;
}

.spritesheet-info {
    background: #e6fffa;
    border: 1px solid #38b2ac;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    color: #234e52;
}

.sprite-resize-controls {
    background: #f0f7ff;
    border: 1px solid #bee3f8;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.sprite-resize-controls h4 {
    margin: 0 0 15px 0;
    color: #2d3748;
}

.sprite-resize-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.sprites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.sprite-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sprite-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #4299e1;
}

.sprite-preview {
    width: 100%;
    max-width: 200px;
    height: auto;
    image-rendering: pixelated;
    border: 2px solid #e2e8f0;
    border-radius: 5px;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(-45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f1f1f1 75%), 
                linear-gradient(-45deg, transparent 75%, #f1f1f1 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.sprite-info {
    font-size: 12px;
    color: #718096;
    margin-bottom: 10px;
}

.sprite-copy-btn {
    background: #4299e1;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    width: 100%;
}

.sprite-copy-btn:hover {
    background: #3182ce;
}

.sprite-copy-btn:active {
    background: #2c5282;
}

.sprite-title {
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 5px;
    font-size: 14px;
}

.error {
    background: #fed7d7;
    border: 1px solid #fc8181;
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
    color: #c53030;
    display: none;
}

.color-editing-section {
    margin: 20px 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    display: none;
}

.color-editor-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.large-preview-container {
    flex: 1;
    min-width: 640px;
    max-width: 640px;
}

.large-preview-canvas {
    width: 640px;
    height: 640px;
    image-rendering: pixelated;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: crosshair;
    background: linear-gradient(45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(-45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f1f1f1 75%), 
                linear-gradient(-45deg, transparent 75%, #f1f1f1 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.color-palette-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-width: 280px;
}

.color-panel {
    width: 100%;
    max-width: 280px;
}

.color-panel-title {
    text-align: center;
    margin: 0 0 15px 0;
    padding: 10px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px 8px 0 0;
    color: #2d3748;
    font-size: 16px;
    font-weight: bold;
}

.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 20px;
    background: white;
    border-radius: 0 0 10px 10px;
    border: 1px solid #e2e8f0;
    border-top: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.color-selection-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.selected-color-display {
    display: none;
    align-items: center;
    gap: 15px;
    padding: 15px;
    margin-top: 15px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.selected-color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #2d3748;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    border: 2px solid #cbd5e0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-swatch:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-color: #4299e1;
}

.color-swatch.selected {
    border-color: #2b6cb0;
    border-width: 3px;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.3);
}

.color-swatch::after {
    content: attr(data-color-name);
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #4a5568;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.95);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.color-swatch:hover::after {
    opacity: 1;
}

.reset-btn {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    width: 100%;
    max-width: 280px;
}

.reset-btn:hover {
    background: #c53030;
}

.override-instructions {
    font-size: 14px;
    color: #4a5568;
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #edf2f7;
    border-radius: 8px;
}

.active-overrides {
    margin-top: 20px;
    font-size: 12px;
}

.override-item {
    background: #edf2f7;
    padding: 12px;
    border-radius: 8px;
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.override-remove {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.override-remove:hover {
    background: #c53030;
}

/* Responsive design */
@media (max-width: 900px) {
    .color-editor-container {
        flex-direction: column;
    }
    
    .large-preview-container {
        min-width: 100%;
        max-width: 100%;
    }
    
    .large-preview-canvas {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        max-width: 640px;
    }
    
    .color-palette-container {
        width: 100%;
        min-width: 100%;
    }
    
    .color-palette-grid {
        max-width: 100%;
    }
}


/* Modal Only */


/* Modal Styles - Add this to your styles.css file */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 800px;
    max-height: 90vh;
    width: 90%;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px 15px;
    border-bottom: 2px solid #e2e8f0;
}

.modal-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 24px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #718096;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #edf2f7;
    color: #2d3748;
}

.modal-body {
    padding: 20px 30px;
}

.modal-section {
    margin-bottom: 25px;
}

.modal-section h3 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 18px;
}

.success-message {
    background: #c6f6d5;
    color: #22543d;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 0;
    border-left: 4px solid #38a169;
}

.dimension-info {
    background: #edf2f7;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.6;
}

.dimension-label {
    font-weight: bold;
    color: #2d3748;
}

.dimension-value {
    color: #4299e1;
    font-weight: bold;
    font-size: 18px;
}

.modal-sprite-preview {
    text-align: center;
    background: #f7fafc;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.modal-preview-canvas {
    max-width: 200px;
    max-height: 200px;
    image-rendering: pixelated;
    border: 2px solid #cbd5e0;
    border-radius: 5px;
    background: linear-gradient(45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(-45deg, #f1f1f1 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f1f1f1 75%), 
                linear-gradient(-45deg, transparent 75%, #f1f1f1 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
}

.instruction-list {
    background: #f0f7ff;
    padding: 20px 30px;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
    margin: 0;
}

.instruction-list li {
    margin-bottom: 12px;
    line-height: 1.5;
    color: #2d3748;
}

.instruction-list li:last-child {
    margin-bottom: 0;
}

.modal-tip {
    background: #fffbeb;
    border: 1px solid #f6cc4d;
    border-radius: 8px;
    padding: 15px;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.modal-footer {
    padding: 15px 30px 25px;
    text-align: center;
    border-top: 1px solid #e2e8f0;
}

.modal-button {
    background: #4299e1;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.modal-button:hover {
    background: #3182ce;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(66, 153, 225, 0.4);
}

/* Error Modal Specific Styles */
.error-modal-content {
    max-width: 500px;
}

.error-modal-header {
    background: #fed7d7;
    border-bottom: 2px solid #fc8181;
}

.error-modal-header h2 {
    color: #c53030;
}

.error-modal-message {
    font-size: 16px;
    line-height: 1.6;
    color: #2d3748;
    margin: 0;
    padding: 20px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 4px solid #fc8181;
}

.error-modal-button {
    background: #e53e3e;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.error-modal-button:hover {
    background: #c53030;
    box-shadow: 0 6px 16px rgba(229, 62, 62, 0.4);
}

@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);
    }
}

/* Mobile responsive additions for modal */
@media (max-width: 900px) {
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .modal-header, .modal-body, .modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
}