* {
    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;
}

/* Навигация */
.main-nav {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* Основной контент */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.page-container {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

h1 {
    color: #333;
    margin-bottom: 2rem;
    text-align: center;
}

/* Кнопки */
.btn-primary, .btn-check, .btn-download {
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-check {
    background: #2196F3;
    color: white;
    font-size: 1.1rem;
    padding: 12px 40px;
}

.btn-check:hover {
    background: #1976D2;
    transform: translateY(-2px);
}

.btn-download {
    background: #FF9800;
    color: white;
}

.btn-download:hover {
    background: #F57C00;
}

/* Задания */
.task-controls {
    text-align: center;
    margin-bottom: 2rem;
}

.task-container {
    margin-top: 2rem;
}

.task-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    border-left: 4px solid #667eea;
}

.task-text {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 1rem 0;
    color: #333;
}

.code-block {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre-wrap;
    margin-top: 1rem;
}

/* Секция учеников */
.students-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.student-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
}

.student-card h3 {
    margin-bottom: 1rem;
    color: #667eea;
}

.student-select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: inherit;
}

.answer-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: monospace;
    margin-bottom: 1rem;
}

.answer-input:focus {
    outline: none;
    border-color: #667eea;
}

.result {
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.result.correct {
    background: #d4edda;
    color: #155724;
}

.result.incorrect {
    background: #f8d7da;
    color: #721c24;
}

/* Действия */
.action-buttons {
    text-align: center;
    margin: 2rem 0;
}

.winner-message {
    text-align: center;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 1rem;
}

.winner-message.both-win {
    background: #d4edda;
    color: #155724;
}

.winner-message.one-win {
    background: #fff3cd;
    color: #856404;
}

.winner-message.both-lose {
    background: #f8d7da;
    color: #721c24;
}

/* Загрузка */
.loading {
    text-align: center;
    padding: 1rem;
    color: #666;
    font-size: 1.1rem;
}

.hidden {
    display: none;
}

.welcome-message {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.2rem;
}

/* Таблица статистики */
.stats-table-container {
    overflow-x: auto;
    margin: 2rem 0;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stats-table th,
.stats-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.stats-table th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.stats-table tr:hover {
    background: #f5f5f5;
}

.score-correct {
    color: #4CAF50;
    font-weight: bold;
}

.score-high {
    color: #4CAF50;
    font-weight: bold;
}

.score-medium {
    color: #FF9800;
    font-weight: bold;
}

.score-low {
    color: #f44336;
    font-weight: bold;
}

.history-cell {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.history-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
}

.history-correct {
    background: #4CAF50;
    color: white;
}

.history-wrong {
    background: #f44336;
    color: white;
}

/* Сводная статистика */
.summary-stats {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 10px;
}

.summary-stats h3 {
    margin-bottom: 1rem;
    color: #333;
}

.summary-card {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 2rem;
}

.summary-item {
    text-align: center;
}

.summary-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.summary-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

/* Адаптивность */
@media (max-width: 768px) {
    .students-section {
        grid-template-columns: 1fr;
    }

    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    main {
        padding: 0 1rem;
    }

    .page-container {
        padding: 1rem;
    }

    .summary-card {
        flex-direction: column;
        gap: 1rem;
    }
}