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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

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

main {
    padding: 40px;
}

section {
    margin-bottom: 50px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.input-section textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.3s;
}

.input-section textarea:focus {
    outline: none;
    border-color: #667eea;
}

.options {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.options label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 0.95em;
}

.options input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.options input[type="number"] {
    width: 60px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 10px 20px;
    font-size: 0.95em;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    font-weight: 600;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.count {
    background: #f0f4ff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #667eea;
    font-weight: 600;
    font-size: 1.1em;
}

.selection-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.flashcards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(850px, 1fr));
    gap: 20px;
}

.flashcard {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: #fafafa;
    transition: transform 0.2s, box-shadow 0.2s, border 0.2s, background 0.2s;
    cursor: pointer;
}

.flashcard:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.flashcard.selected {
    border: 3px solid #667eea;
    background: #f0f4ff;
}

.flashcard.selected:hover {
    border-color: #764ba2;
}

.flashcard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.flashcard-number {
    background: #667eea;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
}

.flashcard-move {
    font-weight: 600;
    color: #764ba2;
    font-size: 1.1em;
}

.board-container {
    margin: 15px 0;
}

.flashcard-question {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    font-weight: 500;
    color: #333;
}

.flashcard-info {
    margin-top: 10px;
    font-size: 0.85em;
    color: #666;
}

.instructions {
    background: #fff9e6;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-bottom: 20px;
    line-height: 1.6;
}

.instructions small {
    display: block;
    margin-top: 8px;
    color: #666;
}

.export-section {
    padding-bottom: 0;
}

/* Chessboard styling adjustments */
.board-container {
    max-width: 280px;
    width: 100%;
    overflow: hidden;
}

.board-container svg {
    max-width: 100%;
    height: auto;
}

/* Flashcard sides layout - responsive */
.flashcard-sides {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.flashcard-side {
    flex: 1 1 calc(50% - 10px);
    max-width: 100%;
    border: 2px solid #ddd;
    padding: 15px;
    border-radius: 8px;
    background: white;
}

.flashcard-side h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1em;
}

.flashcard-front {
    border-color: #4CAF50;
}

.flashcard-front h3 {
    color: #4CAF50;
}

.flashcard-back {
    border-color: #2196F3;
}

.flashcard-back h3 {
    color: #2196F3;
}

@media (max-width: 900px) {
    .container {
        margin: 0;
        border-radius: 0;
    }

    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 1.8em;
    }

    main {
        padding: 20px;
    }

    .flashcards-container {
        grid-template-columns: 1fr;
    }
}
