/* ============================================
   СИСТЕМА ТЕСТИРОВАНИЯ - СТИЛИ
   Строгий современный дизайн
   ============================================ */

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

:root {
    --primary: #1a1a2e;
    --primary-light: #16213e;
    --accent: #0f3460;
    --accent-hover: #1a4a7a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f3f4f6;
    --card: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Блокировка копирования */
body * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ============================================
   ВОДЯНОЙ ЗНАК
   ============================================ */

.watermark {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
    opacity: 0.04;
}

.watermark-text {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    transform: rotate(-30deg);
    white-space: nowrap;
}

/* ============================================
   ЭКРАНЫ
   ============================================ */

.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

#screen-test.active {
    display: block;
    padding-top: 100px;
}

.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   КАРТОЧКИ
   ============================================ */

.card {
    background: var(--card);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.card-wide {
    max-width: 700px;
    text-align: left;
}

.card-question {
    text-align: left;
}

.card-result {
    text-align: center;
}

/* ============================================
   ИКОНКИ И ЗАГОЛОВКИ
   ============================================ */

.icon-lock, .icon-user {
    font-size: 48px;
    margin-bottom: 16px;
}

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

h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.subtitle {
    color: var(--text-light);
    margin-bottom: 32px;
}

/* ============================================
   ФОРМЫ
   ============================================ */

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--card);
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 52, 96, 0.1);
}

.error-text {
    color: var(--danger);
    font-size: 14px;
    margin-top: 8px;
    min-height: 20px;
}

/* ============================================
   КНОПКИ
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 140px;
}

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

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

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

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

/* ============================================
   ПРАВИЛА И ШКАЛА ОЦЕНОК
   ============================================ */

.rules-section {
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.rules-section:last-of-type {
    border-bottom: none;
}

.rules-section ul {
    list-style: none;
    padding-left: 0;
}

.rules-section li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.rules-section li::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: var(--accent);
    font-weight: bold;
}

.warning {
    color: var(--danger);
}

.grade-table {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.grade-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
}

.grade-5 { background: rgba(16, 185, 129, 0.1); color: #059669; }
.grade-4 { background: rgba(59, 130, 246, 0.1); color: #2563eb; }
.grade-3 { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.grade-2 { background: rgba(239, 68, 68, 0.1); color: #dc2626; }

.grade-label { font-weight: 600; }
.grade-range { text-align: center; }
.grade-questions { text-align: right; font-size: 14px; opacity: 0.8; }

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0;
    padding: 16px;
    background: var(--bg);
    border-radius: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
    font-weight: 500;
}

/* ============================================
   ТЕСТ - ХЕДЕР
   ============================================ */

.test-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--primary);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    box-shadow: var(--shadow);
}

.test-info {
    display: flex;
    gap: 24px;
}

#question-counter {
    font-weight: 600;
}

#section-label {
    opacity: 0.8;
    font-size: 14px;
}

.timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Consolas', monospace;
}

.timer.warning {
    color: var(--warning);
    animation: pulse 1s infinite;
}

.timer.danger {
    color: var(--danger);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ============================================
   ТЕСТ - ПРОГРЕСС БАР
   ============================================ */

.test-progress {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-light);
    z-index: 99;
}

.progress-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
}

.progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
    width: 0%;
}

/* ============================================
   ТЕСТ - ВОПРОСЫ
   ============================================ */

.question-text {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 28px;
    line-height: 1.7;
    color: var(--primary);
}

.answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.answer-option {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card);
}

.answer-option:hover {
    border-color: var(--accent);
    background: rgba(15, 52, 96, 0.02);
}

.answer-option.selected {
    border-color: var(--accent);
    background: rgba(15, 52, 96, 0.08);
}

.answer-option input[type="radio"] {
    display: none;
}

.answer-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 16px;
    transition: all 0.2s;
}

.answer-option.selected .answer-letter {
    background: var(--accent);
    color: white;
}

.answer-text {
    flex: 1;
    font-size: 15px;
}

/* ============================================
   ТЕСТ - НАВИГАЦИЯ
   ============================================ */

.navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

/* ============================================
   РЕЗУЛЬТАТЫ
   ============================================ */

.result-icon {
    font-size: 72px;
    margin-bottom: 16px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 32px 0;
    flex-wrap: wrap;
}

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

.stat-value {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
}

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

.result-grade {
    display: inline-flex;
    align-items: center;
    gap: 16px;
    padding: 20px 40px;
    background: var(--bg);
    border-radius: 12px;
    margin-bottom: 24px;
}

.grade-text {
    font-size: 18px;
    color: var(--text-light);
}

.grade-value {
    font-size: 48px;
    font-weight: 700;
}

.grade-value.grade-5 { color: #059669; }
.grade-value.grade-4 { color: #2563eb; }
.grade-value.grade-3 { color: #d97706; }
.grade-value.grade-2 { color: #dc2626; }

.result-note {
    color: var(--text-light);
    font-size: 14px;
}

/* ============================================
   ПРЕДУПРЕЖДЕНИЕ
   ============================================ */

.warning-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.warning-overlay.active {
    display: flex;
}

.warning-modal {
    background: var(--card);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.warning-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.warning-modal h2 {
    justify-content: center;
    margin-bottom: 16px;
}

.warning-penalty {
    font-size: 18px;
    margin: 16px 0 24px;
}

.warning-penalty strong {
    color: var(--danger);
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 640px) {
    .card {
        padding: 24px;
    }

    h1 {
        font-size: 22px;
    }

    .test-header {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
    }

    .test-info {
        font-size: 14px;
    }

    #screen-test.active {
        padding-top: 100px;
    }

    .grade-row {
        grid-template-columns: 1fr;
        gap: 4px;
        text-align: left;
    }

    .grade-range, .grade-questions {
        text-align: left;
    }

    .result-stats {
        gap: 24px;
    }

    .navigation {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* ============================================
   ПЕЧАТЬ БЛОКИРОВКА
   ============================================ */

@media print {
    body * {
        display: none !important;
    }

    body::after {
        content: "Печать запрещена";
        display: block;
        font-size: 24px;
        text-align: center;
        padding: 100px;
    }
}
