/* ==================== БАЗА ==================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #F4F7FA;
    color: #1F2937;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.btn:active {
    transform: scale(0.98);
}
.btn-primary {
    background: #1F4E78;
    color: #fff;
}
.btn-primary:hover {
    background: #163a5a;
}
.btn-secondary {
    background: #E5E9F0;
    color: #1F2937;
}
.btn-secondary:hover {
    background: #D8DEE9;
}
.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 18px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error {
    background: #FDECEA;
    color: #C0392B;
    border: 1px solid #F5C6CB;
}

/* ==================== СТРАНИЦА ВХОДА ==================== */
.page-entry {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #1F4E78 0%, #2E7D32 100%);
}

.entry-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px 32px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.entry-icon {
    font-size: 56px;
    margin-bottom: 8px;
}

.entry-card h1 {
    font-size: 22px;
    margin: 0 0 4px;
    color: #1F4E78;
}

.entry-subtitle {
    color: #6B7280;
    margin: 0 0 28px;
    font-size: 14px;
}

.entry-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.entry-form label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.entry-form input {
    padding: 14px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s ease;
}
.entry-form input:focus {
    border-color: #1F4E78;
}

.entry-hint {
    margin-top: 20px;
    font-size: 12px;
    color: #9CA3AF;
}

/* ==================== СТРАНИЦА МОДУЛЕЙ ==================== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
}
.topbar-name {
    font-weight: 600;
    color: #1F4E78;
}
.topbar-link {
    font-size: 14px;
    color: #6B7280;
    text-decoration: underline;
}

.modules-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

.modules-title {
    text-align: center;
    color: #1F2937;
    margin-bottom: 24px;
}

.general-btn {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #F6B93B, #E58E26);
    border-radius: 18px;
    padding: 24px 28px;
    color: #fff;
    box-shadow: 0 10px 30px rgba(229, 142, 38, 0.35);
    margin-bottom: 36px;
    transition: transform 0.15s ease;
}
.general-btn:hover {
    transform: translateY(-2px);
}
.general-btn-icon {
    font-size: 48px;
}
.general-btn-title {
    display: block;
    font-size: 22px;
    font-weight: 700;
}
.general-btn-sub {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

.modules-subtitle {
    text-align: center;
    color: #6B7280;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 20px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.module-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    border: 2px solid transparent;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.module-card:hover {
    border-color: #1F4E78;
    transform: translateY(-3px);
}
.module-card-icon {
    font-size: 40px;
    margin-bottom: 10px;
}
.module-card-title {
    font-weight: 600;
    font-size: 15px;
    color: #1F2937;
    margin-bottom: 6px;
    min-height: 40px;
}
.module-card-count {
    font-size: 12px;
    color: #9CA3AF;
}

/* ==================== СТРАНИЦА ТЕСТА ==================== */
.quiz-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    flex-wrap: wrap;
    gap: 8px;
}
.quiz-topbar-title {
    font-weight: 700;
    color: #1F4E78;
}
.quiz-topbar-progress-text {
    font-size: 14px;
    color: #6B7280;
}

.progress-bar {
    height: 6px;
    background: #E5E7EB;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #1F4E78, #2E7D32);
    transition: width 0.3s ease;
}

.quiz-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 20px 60px;
}

.question-card {
    background: #fff;
    border-radius: 18px;
    padding: 28px 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.question-text {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 22px;
    color: #1F2937;
}

.answers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-btn {
    text-align: left;
    padding: 14px 18px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    background: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.answer-btn:hover:not(:disabled) {
    border-color: #1F4E78;
    background: #F0F5FA;
}
.answer-btn:disabled {
    cursor: default;
}
.answer-btn-selected {
    border-color: #1F4E78;
}
.answer-correct {
    background: #E8F5E9 !important;
    border-color: #4CAF50 !important;
}
.answer-wrong {
    background: #FDECEA !important;
    border-color: #E74C3C !important;
}
.answer-correct-hint {
    background: #E8F5E9 !important;
    border-color: #4CAF50 !important;
}

.explanation-box {
    margin-top: 22px;
    padding: 18px 20px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}
.explanation-box-correct {
    background: #E8F5E9;
    border: 1px solid #A5D6A7;
}
.explanation-box-wrong {
    background: #FDECEA;
    border: 1px solid #F5B7B1;
}
.explanation-icon {
    font-size: 28px;
}
.explanation-text {
    font-size: 15px;
    white-space: pre-line;
    color: #374151;
}
.critical-note {
    font-size: 13px;
    font-weight: 600;
    color: #B71C1C;
    background: #FFF3E0;
    padding: 10px 12px;
    border-radius: 8px;
}

/* ==================== СТРАНИЦА РЕЗУЛЬТАТА ==================== */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.page-result {
    min-height: 100vh;
    padding: 40px 20px;
}

.page-result.level-excellent {
    background: linear-gradient(135deg, #FFF9E6, #FFEFC2);
}
.page-result.level-partial {
    background: linear-gradient(135deg, #ECEFF1, #CFD8DC);
}
.page-result.level-fail {
    background: linear-gradient(135deg, #37474F, #263238);
    color: #ECEFF1;
}

.result-wrap {
    max-width: 720px;
    margin: 0 auto;
}

.result-card {
    background: #fff;
    border-radius: 20px;
    padding: 36px 28px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    color: #1F2937;
}

.result-badge {
    font-size: 64px;
    margin-bottom: 10px;
}

.result-title {
    margin: 0 0 6px;
    font-size: 26px;
}

.result-name {
    color: #6B7280;
    margin: 0 0 18px;
    font-size: 14px;
}

.result-message {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.result-image-placeholder {
    background: #F3F4F6;
    border: 2px dashed #D1D5DB;
    border-radius: 14px;
    padding: 40px 20px;
    color: #9CA3AF;
    font-size: 14px;
    margin-bottom: 24px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.result-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1F4E78;
}
.result-stat-label {
    font-size: 12px;
    color: #9CA3AF;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.result-review {
    background: #fff;
    border-radius: 18px;
    padding: 28px 24px;
    margin-top: 28px;
    color: #1F2937;
}
.result-review h2 {
    font-size: 18px;
    margin-top: 0;
}
.result-review-perfect {
    text-align: center;
    font-size: 16px;
}

.review-item {
    border-top: 1px solid #E5E7EB;
    padding: 18px 0;
}
.review-item:first-of-type {
    border-top: none;
}
.review-question {
    font-weight: 600;
    margin-bottom: 10px;
}
.review-number {
    color: #9CA3AF;
    margin-right: 4px;
}
.review-weight {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
    vertical-align: middle;
}
.review-weight-критический {
    background: #FDECEA;
    color: #C0392B;
}
.review-weight-высокий {
    background: #FDF0E3;
    color: #C7791E;
}
.review-weight-средний {
    background: #FEF9E7;
    color: #A08A00;
}
.review-weight-низкий {
    background: #EAF6EC;
    color: #4C8A57;
}

.review-your-answer, .review-correct-answer {
    font-size: 14px;
    margin-bottom: 8px;
    padding: 10px 14px;
    border-radius: 10px;
}
.review-your-answer {
    background: #FDECEA;
}
.review-correct-answer {
    background: #E8F5E9;
}
.review-explanation {
    margin-top: 6px;
    color: #4B5563;
    font-size: 13px;
}

/* ==================== АДАПТИВНОСТЬ ==================== */
@media (max-width: 480px) {
    .general-btn {
        flex-direction: column;
        text-align: center;
    }
    .result-stats {
        gap: 16px;
    }
}
