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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px 2.5%;
    line-height: 1.6;
}

.container {
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    padding: 40px;
    width: 95%;
    max-width: 1200px;
    position: relative;
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.preloader.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4f883d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-text {
    color: #4a5568;
    font-size: 1.1em;
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

h1 {
    text-align: center;
    font-size: 2.5em;
    color: #2d3748;
    margin-bottom: 10px;
    font-weight: 700;
}

.topic-section {
    margin-bottom: 40px;
}

.topic-section label {
    display: block;
    font-size: 1.1em;
    color: #4a5568;
    margin-bottom: 10px;
    font-weight: 500;
}

.topic-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 5px;
}

.topic-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.topic-input:focus {
    outline: none;
    border-color: #4f883d;
    box-shadow: 0 0 0 3px rgba(79, 136, 61, 0.1);
}

/* NOWE: Style dla przykładowych tematów */
.example-topics {
    display: block;
    font-size: 1.1em;
    color: #4a5568;
    margin-bottom: 10px;
    font-weight: 500;
}

.topic-example {
    color: #4f883d;
    cursor: pointer;
    text-decoration: underline;
    transition: all 0.3s ease;
}

.topic-example:hover {
    color: #3a6d2e;
    text-decoration: none;
}

.play-btn {
    background: linear-gradient(135deg, #4f883d 0%, #3a6d2e 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 136, 61, 0.3);
}

.play-btn.secondary {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
}

.play-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Grid dwukolumnowy dla ustawień */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 10px;
}

.section {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.section-icon {
    width: 24px;
    height: 24px;
    color: #4f883d;
    flex-shrink: 0;
}

.section-title {
    font-size: 1.4em;
    font-weight: 600;
    color: #2d3748;
}

.difficulty-options {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.difficulty-btn {
    flex: 1;
    padding: 14px 16px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1em;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 70px;
}

.difficulty-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.difficulty-btn.selected {
    background: linear-gradient(135deg, #4f883d 0%, #3a6d2e 100%);
    color: white;
    border-color: #4f883d;
}

/* Questions selection */
.questions-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.question-btn {
    width: 50px;
    height: 50px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.question-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: scale(1.05);
}

.question-btn.selected {
    background: linear-gradient(135deg, #4f883d 0%, #3a6d2e 100%);
    color: white;
    border-color: #4f883d;
}

.game-area {
    display: none;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.question-card {
    background: #f7fafc;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 20px;
}

.question-prompt {
    font-size: 1.1em;
    color: #4a5568;
    margin-top: 10px;
}

.statements-list {
    list-style: none;
    margin-top: 20px;
}

.statement-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.statement-item:hover {
    border-color: #cbd5e0;
    transform: translateX(4px);
}

.statement-item.selected {
    border-color: #4f883d;
    background: rgba(79, 136, 61, 0.05);
}

.statement-item.correct {
    border-color: #4f883d;
    background: rgba(79, 136, 61, 0.1);
}

.statement-item.correct::after {
    content: "✓";
    position: absolute;
    right: 20px;
    color: #4f883d;
    font-weight: bold;
    font-size: 1.2em;
}

.statement-item.wrong {
    border-color: #f56565;
    background: rgba(245, 101, 101, 0.1);
}

.statement-item.wrong::after {
    content: "✗";
    position: absolute;
    right: 20px;
    color: #f56565;
    font-weight: bold;
    font-size: 1.2em;
}

.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.score-display {
    text-align: center;
    font-size: 1.1em;
    color: #4a5568;
    background: #f7fafc;
    padding: 10px 20px;
    border-radius: 25px;
    display: inline-block;
    margin: 0 auto;
    font-weight: 600;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    color: #2d3748;
    margin-bottom: 30px;
    font-size: 1.8em;
}

.final-score {
    margin-bottom: 30px;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f883d 0%, #3a6d2e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 1.8em;
    font-weight: bold;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px 2.5%;
    }
    
    .container {
        padding: 24px;
        border-radius: 16px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .difficulty-options {
        justify-content: center;
    }
    
    .difficulty-btn {
        min-width: 80px;
    }
    
    .questions-options {
        justify-content: center;
    }
    
    .topic-input-group {
        flex-direction: column;
    }
    
    .play-btn {
        width: 100%;
        justify-content: center;
    }
    
    .question-btn {
        width: 45px;
        height: 45px;
        font-size: 1em;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .game-controls .play-btn {
        min-width: 200px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 16px;
    }
    
    h1 {
        font-size: 1.6em;
        margin-bottom: 30px;
    }
    
    .settings-grid {
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .question-card {
        padding: 20px;
    }
    
    .modal-content {
        padding: 24px;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
        font-size: 1.5em;
    }
    
    .questions-options {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }
    
    .question-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9em;
    }
    
    .difficulty-options {
        flex-direction: column;
        gap: 8px;
    }
    
    .difficulty-btn {
        min-width: auto;
        width: 100%;
    }
}
