* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #2b2b2b;
    min-height: 100vh;
    color: #bbbbbb;
    font-size: 13px;
    line-height: 1.4;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: #ffffff;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo {
    height: 80px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

header h1 {
    font-size: 2.2rem;
    margin: 0;
    color: #ffffff;
    font-weight: 400;
    letter-spacing: -0.5px;
}

header p {
    font-size: 1rem;
    color: #cccccc;
    font-weight: 300;
}

main {
    background: #3c3c3c;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 2px dashed #6a6a6a;
    border-radius: 4px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #2b2b2b;
}

.upload-area:hover {
    border-color: #4a9eff;
    background: #323232;
}

.upload-area.dragover {
    border-color: #4a9eff;
    background: #2a3a4a;
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.upload-content h3 {
    color: #bbbbbb;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 400;
}

.upload-content p {
    color: #888888;
    font-size: 0.85rem;
}

.upload-mode {
    margin-top: 20px;
    padding: 15px;
    background: #2b2b2b;
    border-radius: 4px;
    border: 1px solid #4a4a4a;
}

.mode-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 10px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.mode-option:hover {
    background: #3a3a3a;
}

.mode-option input[type="radio"] {
    margin: 0;
    accent-color: #4a9eff;
}

.mode-option span {
    font-weight: 400;
    color: #bbbbbb;
}

.checkbox-label {
    margin-left: 8px;
    font-size: 0.85rem;
    color: #bbbbbb;
}

.atlas-preview {
    margin-top: 20px;
    padding: 15px;
    background: #2b2b2b;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
}

.atlas-preview h4 {
    color: #bbbbbb;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 400;
}

.atlas-preview .preview-info {
    color: #888888;
    font-size: 0.85rem;
}

.sheet-preview {
    margin-bottom: 15px;
    padding: 10px;
    background: #3c3c3c;
    border: 1px solid #4a4a4a;
    border-radius: 3px;
}

.sheet-preview h5 {
    color: #bbbbbb;
    margin-bottom: 5px;
    font-size: 0.9rem;
    font-weight: 400;
}

.sheet-preview p {
    color: #888888;
    font-size: 0.8rem;
    margin: 0;
}

.preview-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.preview-downloads {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.preview-btn {
    background: #4a9eff;
    color: #ffffff;
    border: 1px solid #4a9eff;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preview-btn:hover {
    background: #5aaeff;
    border-color: #5aaeff;
}

.zoom-info {
    color: #bbbbbb;
    font-size: 12px;
    margin-left: auto;
}

.interactive-canvas-container {
    position: relative;
    border: 1px solid #4a4a4a;
    border-radius: 3px;
    overflow: hidden;
    background: #2b2b2b;
    cursor: grab;
}

.interactive-canvas-container:active {
    cursor: grabbing;
}

.interactive-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    background: 
        linear-gradient(45deg, #3a3a3a 25%, transparent 25%), 
        linear-gradient(-45deg, #3a3a3a 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #3a3a3a 75%), 
        linear-gradient(-45deg, transparent 75%, #3a3a3a 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.sprite-tooltip {
    position: absolute;
    background: #1a1a1a;
    border: 1px solid #4a9eff;
    border-radius: 4px;
    padding: 8px 12px;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    max-width: 250px;
}

.tooltip-content h5 {
    color: #4a9eff;
    margin: 0 0 5px 0;
    font-size: 13px;
    font-weight: 600;
}

.tooltip-content p {
    color: #bbbbbb;
    margin: 2px 0;
    font-size: 11px;
}

.tooltip-content p:last-child {
    color: #888888;
    font-size: 10px;
}

.grid-warning {
    margin-top: 15px;
    padding: 12px;
    background: #4a2a2a;
    border: 1px solid #8a4a4a;
    border-radius: 4px;
}

.warning-content {
    color: #ffaaaa;
    font-size: 0.85rem;
    line-height: 1.4;
}

.warning-content strong {
    color: #ff6666;
}

.apply-suggested-btn {
    background: #4a9eff;
    color: #ffffff;
    border: 1px solid #4a9eff;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s ease;
}

.apply-suggested-btn:hover {
    background: #5aaeff;
    border-color: #5aaeff;
}

.color-palette {
    margin-top: 20px;
    padding: 15px;
    background: #2b2b2b;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
}

.color-palette h3 {
    color: #bbbbbb;
    margin-bottom: 10px;
    font-size: 1rem;
    font-weight: 400;
}

.palette-info {
    color: #888888;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.palette-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.color-swatch {
    position: relative;
    width: 60px;
    height: 60px;
    border: 2px solid #4a4a4a;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 4px;
}

.color-swatch:hover {
    border-color: #4a9eff;
    transform: scale(1.05);
}

.color-swatch .color-info {
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 2px;
    text-align: center;
    line-height: 1.2;
}

.palette-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.palette-btn {
    background: #4a9eff;
    color: #ffffff;
    border: 1px solid #4a9eff;
    padding: 8px 16px;
    border-radius: 3px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.palette-btn:hover {
    background: #5aaeff;
    border-color: #5aaeff;
}

.sprite-selection {
    margin-bottom: 15px;
    padding: 12px;
    background: #3c3c3c;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
}

.sprite-selection h4 {
    color: #bbbbbb;
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 400;
}

.selected-sprite-info {
    margin-bottom: 10px;
}

.selected-sprite-info p {
    color: #bbbbbb;
    font-size: 0.85rem;
    margin: 3px 0;
}

.sprite-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sprite-action-btn {
    background: #4a9eff;
    color: #ffffff;
    border: 1px solid #4a9eff;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sprite-action-btn:hover {
    background: #5aaeff;
    border-color: #5aaeff;
}

.sprite-action-btn.delete-btn {
    background: #ff4a4a;
    border-color: #ff4a4a;
}

.sprite-action-btn.delete-btn:hover {
    background: #ff5a5a;
    border-color: #ff5a5a;
}

.image-count {
    text-align: center;
    color: #888888;
    font-size: 0.85rem;
    font-weight: 400;
}

.image-actions {
    text-align: center;
    margin-top: 10px;
}

.clear-btn {
    background: #6a6a6a;
    color: #bbbbbb;
    border: 1px solid #4a4a4a;
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #8a4a4a;
    border-color: #aa4a4a;
    color: #ffffff;
}

.controls-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #2b2b2b;
    border-radius: 4px;
    border: 1px solid #4a4a4a;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-weight: 400;
    margin-bottom: 5px;
    color: #bbbbbb;
    font-size: 0.85rem;
}

.control-group select,
.control-group input {
    padding: 6px 8px;
    border: 1px solid #4a4a4a;
    border-radius: 3px;
    font-size: 13px;
    background: #3c3c3c;
    color: #bbbbbb;
    transition: all 0.2s ease;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #4a9eff;
    background: #404040;
}

.generate-btn {
    background: #4a9eff;
    color: #ffffff;
    border: 1px solid #4a9eff;
    padding: 8px 16px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    grid-column: 1 / -1;
    justify-self: center;
    min-width: 200px;
}

.generate-btn:hover {
    background: #5aaeff;
    border-color: #5aaeff;
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #6a6a6a;
    border-color: #6a6a6a;
}

.preview-section,
.results-section {
    margin-bottom: 30px;
}

.preview-section h3,
.results-section h3 {
    color: #bbbbbb;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 400;
}

.preview-container,
.results-container {
    border: 1px solid #4a4a4a;
    border-radius: 3px;
    padding: 15px;
    text-align: center;
    background: #2b2b2b;
    margin-bottom: 15px;
}

canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #4a4a4a;
    border-radius: 3px;
    background: 
        linear-gradient(45deg, #3a3a3a 25%, transparent 25%), 
        linear-gradient(-45deg, #3a3a3a 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #3a3a3a 75%), 
        linear-gradient(-45deg, transparent 75%, #3a3a3a 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.preview-info {
    text-align: center;
    color: #888888;
    font-size: 0.85rem;
}

.download-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.download-btn {
    background: #4a9eff;
    color: #ffffff;
    border: 1px solid #4a9eff;
    padding: 8px 16px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background: #5aaeff;
    border-color: #5aaeff;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: #888888;
    font-size: 0.85rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .logo-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo {
        height: 60px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    main {
        padding: 20px;
    }
    
    .controls {
        grid-template-columns: 1fr;
    }
    
    .download-controls {
        flex-direction: column;
        align-items: center;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #4a4a4a;
    border-top: 2px solid #4a9eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
