* {
    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;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 600px;
    width: 100%;
}

.screen {
    display: none;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

h2 {
    color: #333;
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
}

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

.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.btn {
    padding: 15px 30px;
    font-size: 1.1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.number-btn {
    padding: 20px;
    font-size: 1.5em;
    font-weight: bold;
    border: 3px solid #667eea;
    border-radius: 15px;
    background: white;
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.number-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

.progress-info {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
    font-size: 1.1em;
    font-weight: 600;
}

.card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 60px 40px;
    margin: 30px 0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-front,
.card-back {
    backface-visibility: hidden;
}

.card-back {
    position: absolute;
    transform: rotateY(180deg);
}

.card.flipped .card-front {
    display: none;
}

.card.flipped .card-back {
    display: block;
    position: relative;
    transform: none;
}

.problem {
    font-size: 3em;
    font-weight: bold;
    color: white;
    text-align: center;
}

.input-section {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

input[type="number"] {
    flex: 1;
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #ddd;
    border-radius: 10px;
    text-align: center;
}

input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hidden {
    display: none !important;
}

#flashcard-actions {
    flex-direction: row;
    justify-content: center;
}

#flashcard-actions .btn {
    flex: 1;
}

.results-box {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
}

.result-text {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 30px;
}

#practiced-number {
    color: #667eea;
    font-weight: bold;
    font-size: 1.2em;
}

.score {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.score-item {
    flex: 1;
    text-align: center;
    padding: 20px;
    border-radius: 10px;
}

.score-item.correct {
    background: #d4edda;
    color: #155724;
}

.score-item.flipped {
    background: #fff3cd;
    color: #856404;
}

.score-label {
    display: block;
    font-size: 1.1em;
    margin-bottom: 10px;
}

.score-value {
    display: block;
    font-size: 2.5em;
    font-weight: bold;
}

.quiz-header {
    margin-bottom: 20px;
}

.quiz-progress {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 15px;
    flex-wrap: wrap;
}

.progress-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    font-weight: bold;
}

.progress-dot.correct {
    background: #4caf50;
    color: white;
}

.progress-dot.incorrect {
    background: #f44336;
    color: white;
}

.quiz-counter {
    text-align: center;
    color: #666;
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 20px;
}

.final-score {
    text-align: center;
    margin-bottom: 20px;
}

.score-number {
    font-size: 5em;
    font-weight: bold;
    color: #667eea;
    display: block;
}

.score-total {
    font-size: 1.5em;
    color: #666;
}

.result-message {
    font-size: 1.3em;
    color: #333;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .screen {
        padding: 25px;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.5em;
    }

    .number-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .problem {
        font-size: 2em;
    }

    .score-number {
        font-size: 3.5em;
    }
}
