:root {
    --primary: #2c5282; --primary-hover: #2b6cb0;
    --correct: #38a169; --incorrect: #e53e3e;
    --bg: #f7fafc; --card: #ffffff; --text: #2d3748;
    --border: #e2e8f0; --radius: 12px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; padding: 16px; }
.test-container { max-width: 800px; margin: 0 auto; background: var(--card); padding: 24px; border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

header { text-align: center; margin-bottom: 20px; }
.school-header { display: flex; align-items: center; gap: 20px; margin-bottom: 15px; border-bottom: 2px solid var(--border); padding-bottom: 15px; }
.logo-section { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.school-logo { width: 80px; height: 80px; object-fit: contain; }
.school-building { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; border: 2px solid var(--border); }
.school-info { flex: 1; text-align: left; }
.school-info h1 { font-size: clamp(1.2rem, 4vw, 1.6rem); color: var(--primary); margin-bottom: 5px;  text-align: center; }
.school-full-name { font-size: 0.85rem; color: #718096; }
.subtitle { color: #4a5568; font-weight: 500; margin-bottom: 10px; }

.status-bar { display: inline-block; background: #edf2f7; padding: 6px 12px; border-radius: 20px; font-size: 0.9rem; font-weight: 600; }
.input-group { margin: 16px 0 8px; }
.input-group label { display: block; font-weight: 600; margin-bottom: 6px; }
.input-group input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; }
.input-group input:focus { outline: 2px solid var(--primary); }

#questions-wrapper { counter-reset: q-counter; margin-top: 20px; }
.question { counter-increment: q-counter; margin-bottom: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
.question-text { font-weight: 600; margin-bottom: 10px; line-height: 1.4; }
/* Автоматическая нумерация по порядку в DOM */
.question-text::before { content: counter(q-counter) ". "; font-weight: 700; color: var(--primary); margin-right: 5px; }

label { display: flex; align-items: center; min-height: 44px; padding: 8px 10px; margin: 4px 0; border-radius: 6px; cursor: pointer; transition: background 0.15s; }
label:hover { background: #f0f4f8; }
input[type="radio"] { margin-right: 12px; width: 20px; height: 20px; accent-color: var(--primary); flex-shrink: 0; }
input[type="radio"]:disabled, label:has(input:disabled) { opacity: 0.6; cursor: not-allowed; }

button { display: block; width: 100%; padding: 16px; margin-top: 12px; background: var(--primary); color: white; border: none; border-radius: 10px; font-size: 1.05rem; font-weight: 600; cursor: pointer; }
button:hover { background: var(--primary-hover); }
button.disabled { background: #a0aec0; cursor: default; pointer-events: none; }

.retry-btn { background: #ed8936; }
.retry-btn:hover { background: #dd6b20; }
.finish-btn { background: #38a169; }
.finish-btn:hover { background: #2f855a; }
.send-btn { background: #3182ce; }
.pdf-btn { background: #4a5568; }

.result, .final-result { margin-top: 16px; padding: 16px; border-radius: 10px; text-align: center; font-weight: 600; display: none; }
.grade-badge { display: inline-block; background: var(--correct); color: white; padding: 4px 10px; border-radius: 6px; font-size: 1.1rem; margin-left: 8px; }
.final-result { background: #ebf8ff; color: #2c5282; border: 2px solid #bee3f8; }
.final-result .best-score { font-size: 1.4rem; margin: 8px 0; }

.correct-answer { background-color: rgba(56, 161, 105, 0.12); border-left: 4px solid var(--correct); }
.incorrect-answer { background-color: rgba(229, 62, 62, 0.12); border-left: 4px solid var(--incorrect); }
.correct-answer-reveal { display: block; margin-top: 8px; padding: 8px 12px; background: rgba(56, 161, 105, 0.1); color: #276749; border-radius: 6px; font-size: 0.9rem; border-left: 3px solid var(--correct); }
.correct-answer-reveal::before { content: "✓ Верно: "; font-weight: 700; }

.toast { visibility: hidden; min-width: 250px; background-color: #333; color: #fff; text-align: center; border-radius: 8px; padding: 16px; position: fixed; z-index: 1000; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 1rem; }
.toast.show { visibility: visible; -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; animation: fadein 0.5s, fadeout 0.5s 2.5s; }
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} }
@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} }

@media (max-width: 600px) {
    body { padding: 8px; }
    .test-container { padding: 16px; }
    .school-header { flex-direction: column; text-align: center; }
    .school-info { text-align: center; }
    .logo-section { flex-direction: row; justify-content: center; }
    .school-logo { width: 60px; height: 60px; }
    .school-building { width: 100px; height: 70px; }
}

/* Запасные варианты, если Font Awesome не загрузился */
.fa-rotate-right:before { content: "⟳"; font-family: monospace; }
.fa-flag-checkered:before { content: "🏁"; font-family: monospace; }
.fa-paper-plane:before { content: "✉"; font-family: monospace; }
.fa-file-pdf:before { content: "📄"; font-family: monospace; }
.fa-chalkboard-user:before { content: "👨‍🏫"; font-family: monospace; }
.fa-check-circle:before { content: "✓"; font-family: monospace; }
.fa-qrcode:before { content: "📱"; font-family: monospace; }
.fa-user:before { content: "👤"; font-family: monospace; }