:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: rgba(255, 255, 255, 0.1);
    --secondary-hover: rgba(255, 255, 255, 0.2);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
    --font-family: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.app-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    position: relative;
}

.screen {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.4s ease-out forwards;
}

.screen.active {
    display: flex;
}

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

h1 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

select, input {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-family);
    outline: none;
    transition: all 0.2s;
}

select:focus, input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

option {
    background: #1e293b;
    color: #f8fafc;
}

button {
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 1rem;
    padding: 1rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    margin-top: 1rem;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

.secondary-btn {
    background: var(--secondary-color);
    color: white;
}

.secondary-btn:hover {
    background: var(--secondary-hover);
}

.icon-btn {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
}

.icon-btn:hover {
    color: var(--text-primary);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress {
    font-weight: 600;
    color: var(--text-secondary);
}

.mode-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.hidden {
    display: none !important;
}

/* Flashcard */
.flashcard {
    perspective: 1000px;
    height: 250px;
    width: 100%;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

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

.flashcard-front, .flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1e293b; /* solid dark slate */
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
    padding: 2rem;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: #312e81; /* solid dark indigo */
    border-color: rgba(99, 102, 241, 0.5);
}

.flashcard h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.lang-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.flashcard-hint {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: -1rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

/* Typing mode */
.typing-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.typing-card h2 {
    font-size: 2.5rem;
}

.input-group {
    width: 100%;
}

.feedback {
    min-height: 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s;
}

.feedback.correct {
    color: var(--success);
}

.feedback.wrong {
    color: var(--danger);
}

.typing-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.score-display {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 1rem;
}

.results-score {
    font-size: 4rem;
    font-weight: 700;
    text-align: center;
    margin: 2rem 0;
    background: linear-gradient(to right, #10b981, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (max-width: 480px) {
    .app-container {
        padding: 1rem;
    }
    .screen {
        padding: 1.5rem;
    }
    .flashcard h2, .typing-card h2 {
        font-size: 2rem;
    }
}
