@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-primary: #ffffff;
    --text-secondary: #b0c4de;
    --accent-color: #00ffcc;
    --accent-hover: #00ccaa;
    --danger: #ff4c4c;
    --success: #00ffcc;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

header {
    padding: 2rem;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #00ffcc, #00bfff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Views */
.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}
.view.active {
    display: block;
}

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

/* Dashboard */
.category-block {
    margin-bottom: 3rem;
}
.category-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    color: var(--text-secondary);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.module-card {
    padding: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
}

.module-header h3 {
    font-size: 1.4rem;
}
.module-stats {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

button {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.btn-prep {
    background: rgba(0, 191, 255, 0.2);
    color: #00bfff;
    border: 1px solid #00bfff;
}
.btn-prep:hover {
    background: #00bfff;
    color: #fff;
}

.btn-test {
    background: rgba(0, 255, 204, 0.2);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}
.btn-test:hover {
    background: var(--accent-color);
    color: #000;
}

.btn-back {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
    margin-bottom: 2rem;
    max-width: 150px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Preparation View */
.prep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.word-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
    gap: 1rem;
}
.word-item {
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.word-en {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.word-ru {
    font-size: 0.95rem;
    color: var(--text-secondary);
}
.btn-audio {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-audio:hover {
    background: rgba(0, 255, 204, 0.1);
}

/* Test View */
.test-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 3rem 2rem;
}
.test-progress {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.test-word-ru {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    min-height: 80px;
}
.test-variants {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    min-height: 24px;
}
.test-input-wrapper {
    margin-bottom: 2rem;
}
.test-input-wrapper input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    text-align: center;
    outline: none;
    transition: border-color 0.3s ease;
}
.test-input-wrapper input:focus {
    border-color: var(--accent-color);
}
.btn-submit {
    background: var(--accent-color);
    color: #000;
    font-size: 1.2rem;
    padding: 1rem 2rem;
    border-radius: 12px;
    width: 100%;
}
.btn-submit:hover {
    box-shadow: 0 0 20px var(--accent-color);
}
.feedback {
    margin-top: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    min-height: 28px;
}
.feedback.correct {
    color: var(--success);
}
.feedback.incorrect {
    color: var(--danger);
}

/* Results View */
.results-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    padding: 3rem 2rem;
}
.score {
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent-color);
    margin: 2rem 0;
}
.btn-retry {
    background: var(--accent-color);
    color: #000;
    font-size: 1.2rem;
    padding: 1rem 2rem;
    border-radius: 12px;
    margin-top: 2rem;
}

/* Loader */
.loader {
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }
    h1 {
        font-size: 2rem;
    }
    main {
        padding: 1rem;
    }
    .prep-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        text-align: center;
    }
    .btn-test {
        max-width: 100%;
    }
    .test-word-ru {
        font-size: 1.8rem;
    }
    .test-container {
        padding: 1.5rem 1rem;
    }
    .test-input-wrapper input {
        font-size: 1.2rem;
        padding: 0.8rem 1rem;
    }
    .score {
        font-size: 3rem;
    }
}
