@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;700;800&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
    --bg: #f4f8ff;
    --surface: #ffffff;
    --surface-soft: #eef4ff;
    --ink: #17263a;
    --ink-muted: #50627b;
    --brand: #0c63f2;
    --brand-strong: #084dc1;
    --accent: #12a8a1;
    --danger: #cf3348;
    --ok: #1f8f57;
    --border: #d9e4f4;
    --shadow: 0 18px 45px rgba(13, 47, 97, 0.12);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Source Sans 3', 'Segoe UI', sans-serif;
    color: var(--ink);
    background: radial-gradient(1200px 800px at -10% -20%, #d8e8ff 0%, var(--bg) 60%);
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3 {
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    margin: 0 0 12px;
    line-height: 1.25;
}

p {
    margin: 0 0 12px;
}

a {
    color: inherit;
}

.bg-shape {
    position: fixed;
    z-index: -1;
    border-radius: 999px;
    opacity: 0.35;
    filter: blur(10px);
}

.bg-shape-a {
    width: 320px;
    height: 320px;
    right: -90px;
    top: 80px;
    background: #5cd2cb;
}

.bg-shape-b {
    width: 260px;
    height: 260px;
    left: -120px;
    bottom: 40px;
    background: #8fb7ff;
}

.wrap {
    width: min(980px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(217, 228, 244, 0.8);
    background: rgba(250, 252, 255, 0.94);
    backdrop-filter: blur(6px);
}

.topbar-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    font-weight: 800;
    letter-spacing: 0.2px;
    min-width: 0;
    max-width: min(70vw, 760px);
}

.brand-mark {
    min-width: 46px;
    height: 34px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(145deg, var(--brand) 0%, #4792ff 100%);
    color: #fff;
    font-size: 12px;
    padding: 0 6px;
}

.brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content {
    padding: 24px 0 36px;
    display: grid;
    gap: 16px;
    flex: 1 0 auto;
    align-content: start;
}

.site-footer {
    border-top: 1px solid rgba(201, 216, 239, 0.85);
    background: rgba(249, 252, 255, 0.9);
    margin-top: auto;
}

.site-footer-inner {
    min-height: 46px;
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: #5f7390;
}

.site-footer-inner p {
    margin: 0;
}

.site-footer-inner a {
    color: #2e5e98;
    text-decoration: none;
    font-weight: 700;
}

.site-footer-inner a:hover {
    text-decoration: underline;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.hero-card {
    background: linear-gradient(160deg, #ffffff 0%, #f5f9ff 100%);
}

.hero-reference {
    margin-top: 10px;
    margin-bottom: 0;
}

.muted {
    color: var(--ink-muted);
}

.small {
    font-size: 14px;
    margin-bottom: 4px;
}

.form-grid {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.type-grid {
    border: 0;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.legend {
    margin-bottom: 2px;
    font-weight: 700;
}

.type-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.type-card:hover {
    border-color: #b7cff4;
    background: #f8fbff;
}

.type-card input {
    margin-top: 3px;
    accent-color: var(--brand);
}

.type-card span {
    line-height: 1.35;
    font-weight: 600;
}

.type-card input:checked + span {
    color: #053b89;
}

select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    min-height: 46px;
    padding: 0 12px;
    font: inherit;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    border: 0;
    border-radius: 10px;
    min-height: 44px;
    padding: 0 18px;
    cursor: pointer;
    font: 700 16px/1 'Source Sans 3', 'Segoe UI', sans-serif;
    color: #fff;
    background: linear-gradient(130deg, var(--brand) 0%, var(--brand-strong) 100%);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.btn-secondary {
    color: var(--brand-strong);
    background: var(--surface-soft);
    border: 1px solid #c7d9ff;
}

.btn-danger-soft {
    color: #4e6482;
    background: #f4f7fc;
    border: 1px solid #d6e0ee;
}

.btn-danger-soft:hover {
    filter: brightness(1.01);
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.finish-early-row {
    margin-top: 8px;
}

.flash {
    border-radius: 12px;
    padding: 11px 13px;
    border: 1px solid;
    font-weight: 600;
}

.flash-error {
    border-color: #f0c0c8;
    background: #fff1f3;
    color: #952b3a;
}

.flash-info {
    border-color: #c9ddff;
    background: #edf4ff;
    color: #184482;
}

.timer-chip {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #c9d9f2;
    background: #fff;
    border-radius: 999px;
    padding: 0 14px;
    color: #21436f;
    font-weight: 600;
}

.timer-chip strong {
    color: var(--brand-strong);
    min-width: 50px;
    text-align: right;
}

.progress-track {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e5eeff;
    overflow: hidden;
    margin: 12px 0 18px;
}

.progress-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #11afa8 0%, #0f7cc6 100%);
}

.question-meta {
    margin-bottom: 4px;
}

.question-text {
    font-size: 20px;
    margin-bottom: 16px;
}

.question-focus {
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.25;
    margin-bottom: 12px;
}

.question-text.compact {
    font-size: 18px;
}

.chapter-details {
    margin: 0 0 12px;
    border: 1px solid #d2e0f8;
    border-radius: 10px;
    background: #f8fbff;
    padding: 8px 10px;
}

.chapter-details summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: #355a8d;
}

.chapter-details summary::before {
    content: '▸';
    font-size: 13px;
    color: #5b7599;
    transition: transform 0.12s ease;
}

.chapter-details summary::-webkit-details-marker {
    display: none;
}

.chapter-details[open] {
    background: #f2f7ff;
}

.chapter-details[open] summary::before {
    transform: rotate(90deg);
}

.chapter-line {
    margin: 8px 0 0;
    font-size: 14px;
    color: #3d587c;
}

.option-block {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
    background: #fff;
}

.option-block.missing {
    border-color: #f0bdc5;
    background: #fff6f8;
}

.option-label {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 800;
    color: #355a8d;
    background: #eaf2ff;
    border: 1px solid #c8daf7;
}

.option-text {
    margin-bottom: 10px;
}

.choice-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.choice-pill {
    position: relative;
    min-height: 40px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid #c8d8ee;
    cursor: pointer;
    font-weight: 700;
    user-select: none;
    background: #f8fbff;
}

.choice-pill input {
    margin: 0 7px 0 0;
    accent-color: var(--brand);
}

.question-card .question-error {
    margin: 10px 0 18px;
}

.score-card .badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: #ffe7eb;
    color: #a62f42;
    font-size: 12px;
    font-weight: 700;
    margin-left: 10px;
}

.result-status {
    border: 1px solid;
    border-radius: 12px;
    padding: 12px 14px;
    margin: 2px 0 14px;
}

.result-status.pass {
    border-color: #b9dec8;
    background: #edf9f2;
}

.result-status.fail {
    border-color: #efbec7;
    background: #fff1f3;
}

.result-status-head {
    margin: 0;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    font-size: 20px;
    font-weight: 800;
}

.result-status.pass .result-status-head {
    color: #146a41;
}

.result-status.fail .result-status-head {
    color: #962c3f;
}

.result-status-rule {
    margin: 4px 0 0;
    font-size: 14px;
    color: #45607f;
}

.score-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.stat-card {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    border-radius: 12px;
    padding: 12px;
}

.stat-label {
    margin: 0;
    font-size: 14px;
    color: #4f6583;
}

.stat-value {
    margin: 6px 0 0;
    font-size: 26px;
    font-weight: 800;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
}

.review-stack {
    display: grid;
    gap: 12px;
}

.review-filter-row {
    margin-top: 10px;
    margin-bottom: 18px;
}

.review-note {
    margin: -8px 0 14px;
}

.review-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: #fff;
}

.review-card-ok {
    border-color: #cae7d7;
    background: #f6fcf8;
}

.review-card-bad {
    border-color: #f2c7cd;
    background: #fff7f8;
}

.review-card h3 {
    margin-bottom: 4px;
}

.review-chapter-details {
    margin-top: 4px;
    margin-bottom: 10px;
}

.review-status {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 700;
}

.review-status.ok {
    color: var(--ok);
}

.review-status.bad {
    color: var(--danger);
}

.review-list {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.review-item {
    border-radius: 10px;
    border: 1px solid #d3dfef;
    background: #f8fbff;
    padding: 10px;
}

.review-item.ok {
    border-color: #b7deca;
    background: #eef9f2;
}

.review-item.bad {
    border-color: #e6aab4;
    background: #fff0f2;
}

.review-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    margin: 0 0 8px;
}

.review-badge.ok {
    color: #146a41;
    background: #dff3e8;
    border: 1px solid #b5dbca;
}

.review-badge.bad {
    color: #962c3f;
    background: #fde1e6;
    border: 1px solid #efbcc7;
}

.review-item.ok .review-meta strong {
    color: #146a41;
}

.review-item.bad .review-meta strong {
    color: #962c3f;
}

.review-answer {
    margin: 0 0 4px;
}

.review-meta {
    margin: 0;
    font-size: 14px;
}

@media (max-width: 740px) {
    .topbar-inner {
        min-height: 64px;
    }

    .brand {
        max-width: 62vw;
    }

    .brand-text {
        font-size: 13px;
    }

    .card {
        padding: 16px;
        border-radius: 14px;
    }

    .site-footer-inner {
        min-height: auto;
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .question-text {
        font-size: 18px;
    }

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

    .timer-chip {
        padding: 0 10px;
        font-size: 14px;
    }
}
