:root {
    --primary: #4361ee;
    --primary-dark: #3730a3;
    --success: #10b981;
    --danger: #ef4444;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f9fafb;
    --white: #ffffff;
    --border: #e5e7eb;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* Навигация */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}

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

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-menu a:hover {
    color: var(--primary);
}

/* Контейнер */
.container {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 1rem;
}

/* Алерты */
.alert {
    padding: 0.75rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Карточки */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

/* Формы */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Кнопки */
.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

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

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

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

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

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

/* Авторизация */
.auth-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
    font-size: 1.5rem;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Список */
.list-item {
    background: var(--white);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--primary);
}

.list-item h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.list-item .meta {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Тесты */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}

.topic-btn {
    padding: 1rem;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-weight: 500;
    font-size: 0.9rem;
}

.topic-btn:hover {
    border-color: var(--primary);
    background: #eff6ff;
}

.question-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.question-card h3 {
    margin-bottom: 1rem;
    color: var(--text);
    font-size: 1.1rem;
}

.option {
    padding: 0.75rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

.option:hover {
    border-color: var(--primary);
}

.option input[type="radio"] {
    margin-right: 0.75rem;
}

.option.correct {
    background: #d1fae5;
    border-color: var(--success);
}

.option.incorrect {
    background: #fee2e2;
    border-color: var(--danger);
}

/* Результаты */
.result-box {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

.score {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0;
}

/* Физкультура - мобильная адаптация */
.pe-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.video-wrapper {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.video-wrapper video {
    width: 100%;
    height: auto;
    display: block;
}

.video-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.countdown {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    color: white;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(0,0,0,0.8);
    z-index: 10;
}

.stats-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.95rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .container {
        padding: 0 0.75rem;
    }

    .card {
        padding: 1rem;
    }

    .nav-menu {
        gap: 0.5rem;
        font-size: 0.85rem;
    }

    .logo {
        font-size: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .topic-btn {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .question-card {
        padding: 1rem;
    }

    .question-card h3 {
        font-size: 1rem;
    }

    .option {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    .score {
        font-size: 2.5rem;
    }

    .result-box {
        padding: 1.5rem;
    }

    .btn {
        padding: 0.65rem 1rem;
        font-size: 0.95rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .countdown {
        font-size: 3rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .nav-menu {
        flex-wrap: wrap;
        gap: 0.25rem;
        justify-content: center;
    }

    .topics-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Адаптация для планшетов */
@media (min-width: 769px) {
    .pe-container {
        grid-template-columns: 2fr 1fr;
    }
}
