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

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

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
}

h1 {
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2.5em;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.start-screen {
    text-align: center;
}

.start-btn, .submit-btn, .back-btn, .new-test-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 10px;
}

.start-btn:hover, .submit-btn:hover, .back-btn:hover, .new-test-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
}

.question-container {
    margin: 30px 0;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 15px;
    border-left: 5px solid #667eea;
}

.question-number {
    color: #667eea;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.question-text {
    font-size: 1.5em;
    margin: 15px 0;
    color: #333;
}

.answer-input {
    width: 100%;
    padding: 15px;
    font-size: 1.3em;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: border-color 0.3s;
}

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

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 30px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.results-screen {
    text-align: center;
}

.score-display {
    font-size: 3em;
    color: #667eea;
    margin: 30px 0;
    font-weight: bold;
}

.category-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.category-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    border-top: 4px solid #667eea;
}

.category-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.category-score {
    font-size: 2em;
    color: #667eea;
}

.history-screen {
    max-height: 70vh;
    overflow-y: auto;
}

.history-item {
    background: #f8f9fa;
    padding: 20px;
    margin: 15px 0;
    border-radius: 15px;
    border-left: 5px solid #667eea;
    cursor: pointer;
    transition: transform 0.2s;
}

.history-item:hover {
    transform: translateX(5px);
}

.history-date {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.history-score {
    font-size: 1.5em;
    color: #667eea;
    font-weight: bold;
}

.button-group {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.timer-display {
    text-align: center;
    font-size: 1.4em;
    font-weight: bold;
    color: #667eea;
    margin: 20px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #667eea;
}

.emoji {
    font-size: 3em;
    margin: 20px 0;
}

.score-poor {
    color: #e74c3c !important;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-fair {
    color: #f39c12 !important;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-good {
    color: #f1c40f !important;
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.score-excellent {
    color: #27ae60 !important;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.history-score-poor {
    color: #e74c3c !important;
}

.history-score-fair {
    color: #f39c12 !important;
}

.history-score-good {
    color: #f1c40f !important;
}

.history-score-excellent {
    color: #27ae60 !important;
}

.difficulty-selector {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin: 30px 0;
    text-align: center;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.difficulty-btn {
    padding: 15px 10px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
    text-align: center;
}

.difficulty-btn:hover, .difficulty-btn.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.difficulty-btn small {
    display: block;
    font-size: 0.8em;
    opacity: 0.8;
    margin-top: 5px;
}

.operation-selector {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin: 30px 0;
    text-align: center;
}

.operation-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.operation-btn {
    padding: 15px 10px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9em;
    text-align: center;
}

.operation-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.operation-btn.active {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.operation-btn:not(.active) {
    background: #e9ecef;
    color: #6c757d;
    border-color: #e9ecef;
}

/* Animacja dla ostrzeżenia o przełączeniu kart */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

#tabSwitchWarning {
    animation: slideIn 0.5s ease-out;
}

#tabSwitchWarning.fade-out {
    animation: fadeOut 0.5s ease-in;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    .question-text {
        font-size: 1.2em;
    }

    #tabSwitchWarning {
        top: 10px;
        right: 10px;
        max-width: calc(100vw - 40px);
        font-size: 12px;
        padding: 12px 15px;
    }
}