:root {
    --blue: #0068d7;
    --blue-dark: #004f9f;
    --border: #cfd8e6;
    --text: #1b2738;
    --muted: #637083;
    --bg: #f5f7fb;
    --orange: #f29a18;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}

.route-take_exam { background: #fff; }

a { color: var(--blue); text-decoration: none; }

.topbar {
    min-height: 70px;
    background: linear-gradient(90deg, #ffffff, #dff2ff);
    border-bottom: 4px solid var(--blue);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    gap: 20px;
}

.route-login .topbar { display: none; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.logo, .seal {
    display: grid;
    place-items: center;
    background: var(--blue);
    color: #fff;
    font-weight: 700;
}
.logo { width: 44px; height: 44px; border-radius: 8px; }
.seal { width: 70px; height: 70px; border-radius: 50%; border: 4px solid #eaf6ff; }

nav { display: flex; gap: 14px; flex-wrap: wrap; }
nav a { font-weight: 700; color: var(--blue-dark); }

.page { max-width: 1180px; margin: 0 auto; padding: 28px 18px 60px; }
.route-login .page { max-width: none; padding: 0 0 60px; }

.panel, .card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.panel { padding: 24px; }
.card { padding: 18px; }
.compact-form { padding: 14px; margin-bottom: 18px; }

h1, h2, h3 { margin: 0 0 16px; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

label { display: block; margin: 12px 0 6px; font-weight: 700; }
input, select, textarea {
    width: 100%;
    border: 1px solid #c8d2df;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 15px;
    background: #fff;
}
textarea { min-height: 120px; font-family: Consolas, monospace; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    padding: 10px 16px;
    background: var(--blue);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.btn.secondary { background: #506176; }
.btn.warning { background: var(--orange); }
.btn.danger { background: #c83939; }

table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { background: #edf4fb; color: #17385c; }

.alert { padding: 12px 14px; border-radius: 6px; margin: 16px auto; max-width: 900px; background: #e9f8ee; border: 1px solid #9bd6aa; }
.alert.error { background: #fff1f1; border-color: #e5aaaa; }

.login-reference { background: #fff; min-height: 100vh; }
.login-banner {
    min-height: 116px;
    background: linear-gradient(180deg, #ccedff 0%, #f8fdff 100%);
    border-bottom: 1px solid #d4eefc;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    text-align: center;
}
.login-banner h1 { margin: 0; color: #0b67ad; font-size: 30px; text-shadow: 1px 1px 0 #fff; }
.login-banner p { color: #d22a2a; font-size: 18px; margin: 4px 0 0; font-weight: 700; }
.login-copy { max-width: 640px; margin: 60px auto 20px; line-height: 1.8; }
.login-box { max-width: 640px; margin: 0 auto; text-align: right; }
.login-box fieldset {
    border: 1px solid #bfc7d1;
    padding: 18px 26px 24px;
    text-align: left;
}
.login-box legend { color: #666; font-weight: 700; padding: 0 8px; }
.login-box label { display: inline-block; width: 170px; }
.login-box input { display: inline-block; width: calc(100% - 180px); }
.login-box .btn { margin-top: 14px; }

.exam-meta {
    max-width: 1000px;
    margin: 0 auto 20px;
    display: grid;
    grid-template-columns: 250px 270px 140px 1fr;
    gap: 8px 20px;
    color: #10256f;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    line-height: 1.25;
}
.exam-meta strong { font-weight: 700; }
.exam-shell {
    max-width: 1220px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 190px;
    gap: 16px;
}
.exam-paper fieldset {
    min-height: 440px;
    border: 1px solid #1b1b1b;
    border-radius: 6px;
    background: #fff;
    padding: 28px 28px 34px;
}
.exam-paper legend {
    color: #c28a29;
    font-size: 24px;
    padding: 0 18px;
}
.question-item { margin-bottom: 32px; }
.question-item { display: none; }
.question-item.active { display: block; }
.question-item h3 {
    font-family: Georgia, 'Times New Roman', serif;
    line-height: 1.45;
    font-size: 20px;
    color: #c38b2f;
    text-decoration: underline;
    margin-bottom: 14px;
}
.question-item h3 a { color: #c38b2f; text-decoration: underline; }
.question-item h4 {
    font-family: 'Times New Roman', Times, serif;
    font-size: 19px;
    line-height: 1.45;
    font-weight: 700;
    margin: 0 0 38px;
}
.question-image { max-width: 100%; margin: 10px 0; }
.choices { margin-top: 22px; padding-left: 28px; }
.choices p {
    font-family: 'Times New Roman', Times, serif;
    font-size: 19px;
    font-weight: 400;
    line-height: 1.35;
    margin: 0 0 23px;
}
.choices strong {
    display: inline-block;
    min-width: 24px;
    color: #3865d8;
    margin-right: 10px;
    font-family: 'Times New Roman', Times, serif;
}
.exam-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0 12px;
}
.exam-footer-wrap {
    max-width: 980px;
    margin: 20px auto 0;
}
.exam-footer {
    display: block;
    width: 100%;
    height: auto;
    max-height: 170px;
    object-fit: cover;
    object-position: center;
    margin: 0 auto;
    border: 0;
}
.nav-btn {
    min-width: 130px;
    font-size: 20px;
    border-radius: 4px;
    padding: 8px 14px;
}
.nav-btn:disabled { opacity: .55; cursor: not-allowed; }
.exam-side { position: sticky; top: 14px; align-self: start; }
.timer {
    background: var(--orange);
    color: #fff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    font-weight: 700;
    line-height: 1.55;
}
.answer-sheet {
    display: grid;
    grid-template-columns: 1fr repeat(4, 26px);
    border: 1px solid #8c7c46;
    background: #fff4bd;
    font-size: 14px;
}
.answer-sheet div {
    min-height: 25px;
    padding: 3px;
    border-right: 1px solid #8c7c46;
    border-bottom: 1px solid #8c7c46;
    text-align: center;
}
.answer-sheet .q { text-align: left; font-weight: 700; }
.answer-sheet .active-row { background: #21d9d1; }
.answer-box {
    width: 14px;
    height: 14px;
    border: 1px solid #8b8b8b;
    border-radius: 2px;
    background: #f8f8f8;
    padding: 0;
    cursor: pointer;
}
.answer-box.selected {
    background: #fff;
    box-shadow: inset 0 0 0 3px #21d9d1;
}
.result-answer-wrap { margin: 18px 0; max-width: 360px; }
.result-sheet { grid-template-columns: 1fr repeat(5, 42px); }
.result-sheet div { min-height: 30px; }
.result-sheet .correct { color: #057a24; font-weight: 700; }
.result-sheet .wrong { color: #bd1f1f; font-weight: 700; }

@media (max-width: 900px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .route-take_exam .topbar { display: none; }
    .route-take_exam .page {
        width: 1220px;
        max-width: none;
        margin: 0;
        padding: 18px 12px 40px;
    }
    .exam-meta {
        grid-template-columns: 250px 270px 140px 1fr;
        font-size: 18px;
        max-width: 1000px;
        margin-left: 140px;
        margin-right: 0;
    }
    .exam-shell {
        grid-template-columns: 1fr 190px;
        max-width: 1220px;
    }
    .exam-side { position: sticky; top: 10px; }
    .exam-footer-wrap {
        max-width: 980px;
        margin-left: 140px;
        margin-right: 0;
    }
    .login-box label, .login-box input { display: block; width: 100%; }
}
