:root {
    --primary-bg: #f0f4f8;
    --card-bg: #ffffff;
    --text-color: #102a43;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

.flashcard-app {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

header {
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.subtitle {
    font-size: 1.1rem;
    color: #627d98;
}

.flashcard-container {
    width: 100%;
    height: 350px;
    perspective: 1000px;
    margin-bottom: 1.5rem;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
    cursor: pointer;
    border-radius: var(--border-radius);
}

.flashcard:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 4px;
}

.flashcard.is-flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -1px var(--shadow-color);
    border: 1px solid #e2e8f0;
}

.flashcard-back {
    transform: rotateY(180deg);
    background-color: #eef2ff;
}

#question-text, #answer-text {
    font-size: 1.5rem;
    line-height: 1.6;
}

.progress-indicator {
    font-size: 1rem;
    color: #475569;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: white;
    background-color: var(--accent-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
}

.nav-btn:hover {
    background-color: var(--accent-hover);
}

.nav-btn:active {
    transform: scale(0.98);
}

.nav-btn:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
}

.flip-btn-mobile {
    display: none; /* Hidden by default, shown on smaller screens */
}

.instructions {
    margin-top: 2rem;
    color: #627d98;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    .flashcard-container {
        height: 300px;
    }
    #question-text, #answer-text {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .flashcard-container {
        height: 280px;
    }
    #question-text, #answer-text {
        font-size: 1.1rem;
    }
    .nav-btn span {
        display: none; /* Hide text on small screens */
    }
    .nav-btn {
        padding: 0.75rem;
    }
    .flip-btn-mobile {
        display: inline-flex; /* Show dedicated flip button on mobile */
    }
    .flip-btn-mobile span {
        display: none;
    }
    .nav-btn svg {
        width: 24px;
        height: 24px;
    }
}