:root {
    --brand: #2f6fed;
    --brand-dark: #1f4fc4;
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #1d2733;
    --muted: #6b7686;
    --border: #e3e8f0;
    --ok: #1c9a52;
    --bad: #d64545;
    --warn: #e0a02c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand { font-weight: 700; }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.who { color: var(--muted); font-size: 14px; }

.container { max-width: 980px; margin: 24px auto; padding: 0 16px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 20px;
}

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 19px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.muted { color: var(--muted); }

.btn {
    display: inline-block;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: #fff; border-color: var(--bad); color: var(--bad); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; font-size: 14px; }
.alert-ok { background: #eaf7ef; color: var(--ok); }
.alert-error { background: #fdecec; color: var(--bad); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.test-tile {
    display: block;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    color: var(--text);
    background: #fbfcfe;
}
.test-tile:hover { border-color: var(--brand); text-decoration: none; }
.tile-name { font-size: 18px; font-weight: 700; }
.tile-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }

.inline-form { display: inline-flex; gap: 8px; align-items: center; margin-right: 12px; flex-wrap: wrap; }
input[type=text], input[type=password], input[type=number] {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 14px;
    min-width: 150px;
}
label { display: block; margin-bottom: 12px; font-size: 14px; }
label input { display: block; width: 100%; margin-top: 5px; }

/* 登录页 */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 360px; }

/* 考试页 */
.exam-bar { position: sticky; top: 0; }
.exam-controls { display: flex; gap: 14px; align-items: center; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }
.timer.warn { color: var(--warn); }
.timer.danger { color: var(--bad); }

.part { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; }
.part-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.part-title { font-weight: 700; font-size: 17px; }
.instruction { color: var(--muted); font-size: 14px; margin: 6px 0 12px; white-space: pre-line; }
.audio-box { background: #f7f9fc; border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.audio-box audio { width: 100%; }

.q { padding: 12px 0; border-bottom: 1px dashed var(--border); }
.q:last-child { border-bottom: none; }
.q-num { font-weight: 700; margin-right: 6px; }
.q-stem { margin: 0 0 8px; }
.q-prompt { color: #33404f; margin: 0 0 8px; }

.options { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.option { display: flex; gap: 8px; align-items: flex-start; padding: 5px 8px; border-radius: 6px; }
.option:hover { background: #f4f7fd; }
.option input { margin-top: 3px; }

.fill-input { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 14px; width: 100%; max-width: 340px; }

.passage { background: #fffdf5; border: 1px solid #eadfc2; border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; font-size: 15px; }
.passage h3 { margin-top: 0; }
.passage p { margin: 0 0 12px; }
.passage .para-label { font-weight: 700; color: var(--brand); }

/* 成绩页 */
.score-card { text-align: center; }
.score-line { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 8px 0; }
.score-big { font-size: 46px; font-weight: 800; }
.score-total { font-size: 20px; color: var(--muted); font-weight: 500; }
.score-band { font-size: 26px; font-weight: 700; color: var(--brand); }
.legend { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px; }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--bad); }
.row-ok td:first-child { border-left: 3px solid var(--ok); }
.row-bad td:first-child { border-left: 3px solid var(--bad); }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(20,30,50,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 14px; padding: 24px; width: 320px; text-align: center; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }

@media (max-width: 600px) {
    .container { padding: 0 10px; }
    .topbar { padding: 10px 12px; }
    .score-big { font-size: 36px; }
}
