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

:root {
    --primary-color: #0088cc;
    --primary-dark: #006ba3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-color: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    background: var(--bg-color);
}

/* Загрузка */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.screen {
    min-height: 100vh;
    padding: 16px;
    padding-bottom: 80px;
}

/* Заголовок */
.header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-color);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 16px;
    padding: 8px 0;
    cursor: pointer;
    margin-bottom: 12px;
    font-weight: 500;
}

.back-btn:hover {
    opacity: 0.8;
}

/* Главное меню */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.menu-btn {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
    box-shadow: var(--shadow);
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.menu-btn .icon {
    font-size: 32px;
}

.menu-btn .text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}

/* Контент вопроса */
.question-content {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.question-text {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 20px;
}

.answer-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
}

.answer-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.answer-text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-color);
    white-space: pre-wrap;
}

/* Кнопки действий */
.actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.action-btn.primary:hover {
    background: var(--primary-dark);
}

.action-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

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

.action-btn.icon-btn {
    flex: 0 0 48px;
    min-width: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-size: 20px;
    padding: 12px;
}

.action-btn.icon-btn.active {
    background: var(--warning-color);
    color: white;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Навигация */
.nav-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.nav-btn {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: white;
    color: var(--primary-color);
}

/* Поиск */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary-color);
}

.search-btn {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 16px;
    cursor: pointer;
    font-weight: 500;
}

.search-btn:hover {
    background: var(--primary-dark);
}

/* Списки результатов */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.result-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-item-number {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 16px;
}

.result-item-bookmark {
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.result-item-text {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Экзамен */
.exam-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.exam-stats {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.exam-stats span {
    padding: 4px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* Адаптивность */
@media (max-width: 480px) {
    .menu-grid {
        grid-template-columns: 1fr;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .question-text {
        font-size: 16px;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.screen:not(.hidden) {
    animation: fadeIn 0.3s ease;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

