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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
}

header p {
    color: #6c757d;
    font-size: 1.1rem;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.input-section,
.output-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.status-section {
    grid-column: 1 / -1;
    margin-top: 1rem;
}

h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.input-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.option label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
}

input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

input[type="file"]:hover {
    border-color: #007bff;
}

textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.controls label {
    font-weight: 600;
    color: #495057;
}

select,
input[type="number"] {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
}

.board-size {
    display: flex;
    gap: 1rem;
}

.board-size label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.board-size input {
    width: 80px;
}

.primary-btn,
.secondary-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn {
    background-color: #007bff;
    color: white;
    width: 100%;
}

.primary-btn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

.primary-btn:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

.secondary-btn {
    background-color: #6c757d;
    color: white;
}

.secondary-btn:hover {
    background-color: #495057;
    transform: translateY(-1px);
}

.secondary-btn:disabled {
    background-color: #adb5bd;
    cursor: not-allowed;
    transform: none;
}

.output-controls {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.status-info {
    padding: 1rem;
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #b6d4da;
    border-radius: 8px;
    font-weight: 500;
}

.status-error {
    padding: 1rem;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    font-weight: 500;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    main {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .input-section,
    .output-section {
        padding: 1.5rem;
    }
    
    .output-controls {
        flex-direction: column;
    }
    
    .board-size {
        flex-direction: column;
        gap: 0.5rem;
    }
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

#output {
    background-color: #f8f9fa;
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}