/* ===================== 在线考试答题系统 ===================== */
/* 纯前端零后端；颜色全部基于站点主题变量，暗色 / 亮色自动适配 */
/* 工具页默认占满整个电脑端屏幕（保留左侧导航），与工具箱规范一致 */
body.page-exam-full .app { max-width: 100%; }
body.page-exam-full .main-content { max-width: 100%; width: 100%; border-right: 0; }

.ex-app {
    /* ---- 基础语义令牌：随站点主题自动切换 ---- */
    --ex-accent: var(--accent, #1d9bf0);
    --ex-accent-weak: color-mix(in srgb, var(--accent, #1d9bf0) 14%, transparent);
    --ex-card: var(--bg-elevated, #15202b);
    --ex-card-2: var(--bg-secondary, #16181c);
    --ex-line: var(--border-color, #2f3336);
    --ex-ink: var(--text-primary, #e7e9ea);
    --ex-ink-2: var(--text-secondary, #71767b);
    --ex-ok: var(--success, #00ba7c);
    --ex-danger: var(--danger, #f4212e);
    /* 警示色与前景色混合：浅色主题偏深、暗色主题偏亮，两端对比度都达标 */
    --ex-warn: color-mix(in srgb, #e8a317 72%, var(--text-primary, #e7e9ea));

    --ex-radius: 14px;
    /* 超大屏内容测量宽度：仅在 2K 以上显示器生效（1920 及以下仍是满屏），
       避免 4K / 带鱼屏把内容拉成过宽的长行 */
    --ex-measure: 1680px;

    /* ---- 题型色：与 --ex-ink 混合实现主题自适应 ----
       暗色主题下 --ex-ink 接近白色 → 混合后偏亮；
       浅色主题下 --ex-ink 接近黑色 → 混合后偏深。两种主题对比度都充足。 */
    --ex-c-single: color-mix(in srgb, #2f8bff 74%, var(--ex-ink));
    --ex-c-multi:  color-mix(in srgb, #00ba7c 68%, var(--ex-ink));
    --ex-c-judge:  color-mix(in srgb, #e8a317 70%, var(--ex-ink));
    --ex-c-blank:  color-mix(in srgb, #8b5cf6 72%, var(--ex-ink));
    --ex-c-essay:  color-mix(in srgb, #f4212e 74%, var(--ex-ink));

    color: var(--ex-ink);
    font-size: 14px;
    line-height: 1.6;
    /* 站点骨架已铺满整屏；这里只做“超大屏收敛”，常规桌面依旧满屏 */
    max-width: var(--ex-measure);
    margin-inline: auto;
}

.ex-app *,
.ex-app *::before,
.ex-app *::after { box-sizing: border-box; }

/* 强类型排版：标题、题干等长文本统一优化换行与断词 */
.ex-app h1, .ex-app h3 { text-wrap: balance; }
.ex-app p { text-wrap: pretty; }

/* ===================== 英雄区 ===================== */
.ex-hero {
    display: flex; gap: 20px; align-items: flex-start;
    padding: 22px 24px; margin-bottom: 16px;
    background: var(--ex-card);
    border: 1px solid var(--ex-line);
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .06);
}
.ex-hero-icon {
    flex: 0 0 auto; width: 58px; height: 58px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center; color: #fff;
    /* 渐变跟随站点强调色（而非写死蓝色），换主题时整体协调 */
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--ex-accent) 72%, #ffffff), var(--ex-accent));
    box-shadow: 0 6px 18px color-mix(in srgb, var(--ex-accent) 32%, transparent);
}
.ex-hero-icon svg { width: 30px; height: 30px; }
.ex-hero-text { min-width: 0; flex: 1 1 auto; max-width: 760px; }
.ex-hero-text h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -.3px; }
.ex-hero-text p { margin: 0 0 12px; color: var(--ex-ink-2); font-size: 13.5px; line-height: 1.8; }
.ex-hero-text strong { color: var(--ex-ink); }
.ex-hero-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.ex-tag {
    font-size: 12px; padding: 4px 10px; border-radius: 20px; font-weight: 500;
    background: var(--ex-accent-weak); color: var(--ex-accent);
}

/* ===================== 统计条 ===================== */
.ex-stats {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px; margin-bottom: 16px;
}
.ex-stat {
    padding: 13px 15px; background: var(--ex-card); border: 1px solid var(--ex-line);
    border-radius: var(--ex-radius); min-width: 0;
    transition: border-color .15s, transform .15s;
}
.ex-stat:hover { border-color: var(--ex-accent); transform: translateY(-1px); }
.ex-stat-v {
    font-size: 22px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ex-stat-v small { font-size: 12px; font-weight: 500; color: var(--ex-ink-2); margin-left: 3px; }
.ex-stat-k { font-size: 12px; color: var(--ex-ink-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-stat.is-ok .ex-stat-v { color: var(--ex-ok); }
.ex-stat.is-warn .ex-stat-v { color: var(--ex-warn); }
.ex-stat.is-danger .ex-stat-v { color: var(--ex-danger); }
.ex-stat.is-accent .ex-stat-v { color: var(--ex-accent); }

/* ===================== 页签 ===================== */
.ex-tabs {
    display: flex; gap: 4px; margin-bottom: 14px; padding: 5px;
    background: var(--ex-card-2); border: 1px solid var(--ex-line);
    border-radius: 12px; overflow-x: auto; scrollbar-width: none;
    scroll-snap-type: x proximity;
}
.ex-tabs::-webkit-scrollbar { display: none; }
.ex-tab {
    flex: 1 1 auto; min-width: max-content; height: 38px; padding: 0 16px;
    border: 0; border-radius: 9px; cursor: pointer; white-space: nowrap;
    background: transparent; color: var(--ex-ink-2);
    font-size: 13.5px; font-weight: 500; font-family: inherit;
    transition: background .15s, color .15s;
    scroll-snap-align: start;
}
.ex-tab:hover { color: var(--ex-ink); background: var(--ex-bg-hover, var(--ex-card)); }
.ex-tab.is-on {
    background: var(--ex-accent); color: #fff; font-weight: 600;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--ex-accent) 30%, transparent);
}
.ex-tab:active { transform: translateY(1px); }

/* ===================== 页签内容 ===================== */
.ex-pane { display: none; }
.ex-pane.is-on { display: block; animation: ex-fade .2s ease; }
@keyframes ex-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ===================== 工具条 ===================== */
.ex-bar {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    margin-bottom: 12px;
}
.ex-bar-sub {
    padding-top: 10px; border-top: 1px solid var(--ex-line);
}
.ex-bar-inline {
    margin-bottom: 10px; padding: 10px; background: var(--ex-card-2);
    border: 1px solid var(--ex-line); border-radius: 10px;
}
.ex-grow { flex: 1 1 auto; }
.ex-count { font-size: 12.5px; color: var(--ex-ink-2); white-space: nowrap; }

/* ===================== 通用控件 ===================== */
.ex-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 500; font-family: inherit; line-height: 1;
    cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.ex-btn:disabled { opacity: .45; cursor: not-allowed; }
.ex-btn:active:not(:disabled) { transform: translateY(1px); }
.ex-btn-primary { background: var(--ex-accent); color: #fff; }
.ex-btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.ex-btn-primary:not(:disabled) { box-shadow: 0 2px 8px color-mix(in srgb, var(--ex-accent) 26%, transparent); }
.ex-btn-ghost { background: var(--ex-card); color: var(--ex-ink-2); border-color: var(--ex-line); }
.ex-btn-ghost:hover:not(:disabled) {
    background: var(--ex-accent-weak); color: var(--ex-accent); border-color: var(--ex-accent);
}
.ex-btn-danger { background: transparent; color: var(--ex-danger); border-color: var(--ex-line); }
.ex-btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--ex-danger) 12%, transparent); border-color: var(--ex-danger); }
.ex-btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; }
.ex-btn:focus-visible, .ex-icbtn:focus-visible, .ex-tab:focus-visible,
.ex-chip:focus-visible, .ex-qcard-pick:focus-visible, .ex-cbtn:focus-visible,
.ex-segbtn:focus-visible, .ex-opt-dot:focus-visible {
    outline: none; box-shadow: 0 0 0 3px var(--ex-accent-weak);
}

.ex-icbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; padding: 0; border-radius: 8px; cursor: pointer;
    background: transparent; border: 1px solid transparent;
    color: var(--ex-ink-2); font-size: 14px; font-family: inherit;
    transition: background .15s, color .15s;
}
.ex-icbtn:hover:not(:disabled) { background: var(--ex-card-2); color: var(--ex-ink); }
.ex-icbtn:disabled { opacity: .35; cursor: not-allowed; }

.ex-input, .ex-select, .ex-textarea {
    width: 100%; height: 34px; padding: 0 10px; font-size: 13.5px; font-family: inherit;
    color: var(--ex-ink); background: var(--ex-card-2);
    border: 1px solid var(--ex-line); border-radius: 8px; outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.ex-textarea { height: auto; min-height: 70px; padding: 9px 11px; line-height: 1.65; resize: vertical; }
.ex-input:focus, .ex-select:focus, .ex-textarea:focus {
    border-color: var(--ex-accent); box-shadow: 0 0 0 3px var(--ex-accent-weak);
}
.ex-input::placeholder, .ex-textarea::placeholder { color: var(--ex-ink-2); opacity: .75; }
.ex-select {
    appearance: none; padding-right: 26px; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--ex-ink-2) 50%),
                      linear-gradient(135deg, var(--ex-ink-2) 50%, transparent 50%);
    background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px;
    background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.ex-bar .ex-input[type="search"] { flex: 1 1 240px; min-width: 200px; }
.ex-bar .ex-select { width: auto; min-width: 112px; flex: 0 0 auto; }

.ex-label { display: block; font-size: 12.5px; color: var(--ex-ink-2); margin-bottom: 6px; }
.ex-label b { color: var(--ex-danger); }
.ex-tip-inline { font-weight: 400; color: var(--ex-ink-2); opacity: .8; }
.ex-field { margin-bottom: 14px; }
.ex-field:last-child { margin-bottom: 0; }
.ex-chk {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    font-size: 13px; color: var(--ex-ink-2);
}
.ex-chk input { accent-color: var(--ex-accent); width: 15px; height: 15px; cursor: pointer; }
.ex-tip { font-size: 12.5px; color: var(--ex-ink-2); line-height: 1.7; margin: 10px 0 0; }
.ex-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ex-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.ex-empty {
    padding: 46px 20px; text-align: center; color: var(--ex-ink-2);
    background: var(--ex-card); border: 1px dashed var(--ex-line); border-radius: var(--ex-radius);
}
.ex-empty-t { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--ex-ink); }
.ex-empty-d { margin: 0 0 16px; font-size: 13px; }

/* ===================== 题型徽章（主题自适应配色） ===================== */
.ex-badge {
    display: inline-flex; align-items: center; flex: 0 0 auto;
    height: 21px; padding: 0 8px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
    background: var(--ex-card-2); color: var(--ex-ink-2); border: 1px solid var(--ex-line);
}
.ex-badge.t-single { background: color-mix(in srgb, var(--ex-c-single) 15%, transparent); color: var(--ex-c-single); border-color: transparent; }
.ex-badge.t-multi  { background: color-mix(in srgb, var(--ex-c-multi) 15%, transparent);  color: var(--ex-c-multi);  border-color: transparent; }
.ex-badge.t-judge  { background: color-mix(in srgb, var(--ex-c-judge) 17%, transparent);  color: var(--ex-c-judge);  border-color: transparent; }
.ex-badge.t-blank  { background: color-mix(in srgb, var(--ex-c-blank) 16%, transparent);  color: var(--ex-c-blank);  border-color: transparent; }
.ex-badge.t-essay { background: color-mix(in srgb, var(--ex-c-essay) 14%, transparent);  color: var(--ex-c-essay);  border-color: transparent; }
.ex-badge.lv-easy { color: var(--ex-c-multi); }
.ex-badge.lv-mid  { color: var(--ex-c-judge); }
.ex-badge.lv-hard { color: var(--ex-c-essay); }

/* ===================== 列表 ===================== */
.ex-list { display: flex; flex-direction: column; gap: 10px; }
.ex-list-pick { max-height: 46vh; overflow-y: auto; padding-right: 3px; overscroll-behavior: contain; }

.ex-qcard {
    display: flex; gap: 13px; padding: 14px 16px;
    background: var(--ex-card); border: 1px solid var(--ex-line);
    border-radius: var(--ex-radius);
    transition: border-color .15s, box-shadow .15s;
}
.ex-qcard:hover { border-color: var(--ex-accent); box-shadow: 0 3px 14px rgba(0, 0, 0, .07); }
.ex-qcard-idx {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
    background: var(--ex-card-2); color: var(--ex-ink-2);
}
.ex-qcard-main { flex: 1 1 auto; min-width: 0; }
.ex-qcard-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-bottom: 7px;
}
.ex-qcard-stem {
    font-size: 14px; line-height: 1.75; word-break: break-word; white-space: pre-wrap;
}
.ex-qcard-opts { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.ex-qcard-opt {
    font-size: 13px; color: var(--ex-ink-2); line-height: 1.7;
    padding: 3px 9px; border-radius: 7px; background: var(--ex-card-2);
    word-break: break-word;
}
.ex-qcard-opt.is-right {
    color: var(--ex-ok); background: color-mix(in srgb, var(--ex-ok) 13%, transparent); font-weight: 600;
}
.ex-qcard-opt.is-wrong { color: var(--ex-danger); background: color-mix(in srgb, var(--ex-danger) 11%, transparent); }
.ex-qcard-ans {
    margin-top: 9px; padding: 8px 11px; border-radius: 9px; font-size: 12.5px;
    background: var(--ex-card-2); border-left: 3px solid var(--ex-ok); line-height: 1.7;
}
.ex-qcard-ans b { color: var(--ex-ok); }
.ex-qcard-acts { flex: 0 0 auto; display: flex; flex-direction: column; gap: 5px; }
.ex-qcard-pick {
    flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--ex-line); background: var(--ex-card-2);
    color: var(--ex-ink-2); font-size: 14px; font-family: inherit; padding: 0;
    transition: .15s;
}
.ex-qcard-pick.is-on { background: var(--ex-accent); border-color: var(--ex-accent); color: #fff; }

/* ===================== 试卷卡片 ===================== */
.ex-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px;
}
.ex-pcard {
    display: flex; flex-direction: column; gap: 10px; padding: 16px 18px;
    background: var(--ex-card); border: 1px solid var(--ex-line);
    border-radius: var(--ex-radius); transition: border-color .15s, box-shadow .15s;
}
.ex-pcard:hover { border-color: var(--ex-accent); box-shadow: 0 3px 16px rgba(0, 0, 0, .08); }
.ex-pcard-t { font-size: 15.5px; font-weight: 600; line-height: 1.5; word-break: break-word; }
.ex-pcard-m { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ex-ink-2); }
.ex-pcard-m b { color: var(--ex-ink); font-weight: 600; }
.ex-pcard-acts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }

/* ===================== 组卷蓝图 ===================== */
.ex-blueprint { display: flex; flex-direction: column; gap: 9px; }
.ex-bp-row {
    display: grid; grid-template-columns: 74px 1fr 88px; gap: 9px; align-items: center;
}
.ex-bp-row > * { min-width: 0; }
.ex-bp-row > .ex-input { height: 32px; }

/* ===================== 答题区 ===================== */
.ex-run-empty {
    padding: 52px 24px; text-align: center; background: var(--ex-card);
    border: 1px dashed var(--ex-line); border-radius: var(--ex-radius);
}
/* 答题工作区整体居中并限制宽度：模拟“试卷”观感，避免超宽屏上题干拉成长行。
   头部 / 题目 / 底部操作条同宽对齐，不会出现“头尾满屏、中间窄”的错位。 */
.ex-run {
    display: flex; flex-direction: column; gap: 12px;
    width: 100%; max-width: 1240px; margin-inline: auto;
}
.ex-run[hidden], .ex-run-empty[hidden] { display: none !important; }

.ex-run-head {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 12px 16px; background: var(--ex-card);
    border: 1px solid var(--ex-line); border-radius: var(--ex-radius);
    position: sticky; top: 0; z-index: 20;
}
.ex-run-info { flex: 1 1 220px; min-width: 0; }
.ex-run-title {
    font-size: 15px; font-weight: 600; line-height: 1.45;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ex-run-meta { font-size: 12.5px; color: var(--ex-ink-2); margin-top: 2px; }
.ex-run-timer {
    flex: 0 0 auto; min-width: 96px; text-align: center;
    font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums;
    padding: 5px 12px; border-radius: 10px;
    background: var(--ex-card-2); color: var(--ex-ink);
}
.ex-run-timer.is-warn { color: var(--ex-warn); background: color-mix(in srgb, var(--ex-warn) 15%, transparent); }
.ex-run-timer.is-danger {
    color: #fff; background: var(--ex-danger);
    animation: ex-pulse 1s ease-in-out infinite;
}
@keyframes ex-pulse { 50% { opacity: .68; } }
.ex-run-acts { flex: 0 0 auto; display: flex; gap: 7px; }

.ex-run-body { display: flex; gap: 14px; align-items: flex-start; }
.ex-q-wrap { flex: 1 1 auto; min-width: 0; }

.ex-q {
    padding: 20px 22px; background: var(--ex-card);
    border: 1px solid var(--ex-line); border-radius: var(--ex-radius);
}
.ex-q-head {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.ex-q-no {
    font-size: 15px; font-weight: 700; color: var(--ex-accent);
    font-variant-numeric: tabular-nums;
}
.ex-q-stem {
    font-size: 15px; line-height: 1.85; margin-bottom: 16px;
    word-break: break-word; white-space: pre-wrap;
}
.ex-q-opts { display: flex; flex-direction: column; gap: 9px; }
.ex-qopt {
    display: flex; align-items: flex-start; gap: 11px; padding: 11px 14px;
    border: 1px solid var(--ex-line); border-radius: 10px; cursor: pointer;
    background: var(--ex-card-2); transition: border-color .15s, background .15s;
}
.ex-qopt:hover { border-color: var(--ex-accent); }
.ex-qopt.is-on { border-color: var(--ex-accent); background: var(--ex-accent-weak); }
.ex-qopt-k {
    flex: 0 0 auto; width: 24px; height: 24px; border-radius: 7px; margin-top: 1px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 700; font-family: inherit;
    background: var(--ex-card); color: var(--ex-ink-2); border: 1px solid var(--ex-line);
    transition: .15s;
}
.ex-qopt.is-on .ex-qopt-k { background: var(--ex-accent); color: #fff; border-color: var(--ex-accent); }
.ex-qopt-t { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.7; word-break: break-word; }
.ex-q-multi-tip { font-size: 12.5px; color: var(--ex-ink-2); margin-top: 10px; }

.ex-q-judge { display: flex; gap: 10px; }
.ex-q-judge .ex-qopt { flex: 1 1 0; justify-content: center; }
.ex-q-blank-input { display: flex; flex-direction: column; gap: 10px; }
.ex-q-blank-row { display: flex; align-items: center; gap: 10px; }
.ex-q-blank-row > span {
    flex: 0 0 auto; font-size: 13px; color: var(--ex-ink-2);
    min-width: 52px; white-space: nowrap;
}
.ex-q-blank-row > .ex-input { flex: 1 1 auto; }
.ex-q-essay { min-height: 128px; }

/* 答题卡 */
.ex-card {
    flex: 0 0 216px; position: sticky; top: 78px;
    padding: 13px; background: var(--ex-card);
    border: 1px solid var(--ex-line); border-radius: var(--ex-radius);
}
.ex-card[hidden] { display: none !important; }
.ex-card-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; font-weight: 600; margin-bottom: 10px;
}
.ex-card-head .ex-card-count {
    margin-left: auto; margin-right: 4px;
    font-size: 12px; font-weight: 400; color: var(--ex-ink-2);
}
.ex-card-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ex-cbtn {
    height: 30px; border-radius: 7px; cursor: pointer; padding: 0;
    font-size: 12.5px; font-weight: 600; font-family: inherit;
    background: var(--ex-card-2); color: var(--ex-ink-2); border: 1px solid var(--ex-line);
    font-variant-numeric: tabular-nums; transition: .15s;
}
.ex-cbtn:hover { border-color: var(--ex-accent); color: var(--ex-accent); }
.ex-cbtn.is-done { background: var(--ex-accent); border-color: var(--ex-accent); color: #fff; }
.ex-cbtn.is-mark { background: color-mix(in srgb, var(--ex-warn) 22%, transparent); border-color: var(--ex-warn); color: var(--ex-warn); }
.ex-cbtn.is-cur { box-shadow: 0 0 0 2px var(--ex-accent); }
.ex-card-legend {
    display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 11px;
    font-size: 11.5px; color: var(--ex-ink-2);
}
.ex-card-legend span { display: inline-flex; align-items: center; gap: 4px; }
.ex-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--ex-card-2); border: 1px solid var(--ex-line); }
.ex-dot.is-done { background: var(--ex-accent); border-color: var(--ex-accent); }
.ex-dot.is-mark { background: color-mix(in srgb, var(--ex-warn) 45%, transparent); border-color: var(--ex-warn); }

.ex-run-foot {
    display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
    padding: 11px 16px; background: var(--ex-card);
    border: 1px solid var(--ex-line); border-radius: var(--ex-radius);
    position: sticky; bottom: 0; z-index: 20;
}
.ex-run-pos {
    font-size: 13px; color: var(--ex-ink-2); font-variant-numeric: tabular-nums;
    min-width: 56px; text-align: center;
}

/* ===================== 成绩 ===================== */
.ex-trend {
    padding: 14px 16px; margin-bottom: 12px;
    background: var(--ex-card); border: 1px solid var(--ex-line); border-radius: var(--ex-radius);
}
.ex-trend[hidden] { display: none !important; }
.ex-trend-t { font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.ex-trend-bars { display: flex; align-items: flex-end; gap: 8px; height: 108px; }
.ex-tbar {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
    align-items: center; gap: 5px; height: 100%; justify-content: flex-end;
}
.ex-tbar-v {
    font-size: 11px; color: var(--ex-ink-2); font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.ex-tbar-b {
    width: 100%; max-width: 34px; border-radius: 5px 5px 0 0; min-height: 3px;
    background: var(--ex-accent); transition: height .3s;
}
.ex-tbar-b.is-fail { background: var(--ex-danger); }
.ex-tbar-l { font-size: 10.5px; color: var(--ex-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.ex-scard { display: flex; gap: 13px; padding: 14px 16px; background: var(--ex-card);
    border: 1px solid var(--ex-line); border-radius: var(--ex-radius); }
.ex-scard-score {
    flex: 0 0 auto; width: 62px; height: 62px; border-radius: 14px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: var(--ex-card-2); font-weight: 700; font-variant-numeric: tabular-nums;
}
.ex-scard-score b { font-size: 19px; line-height: 1.1; }
.ex-scard-score span { font-size: 10.5px; color: var(--ex-ink-2); font-weight: 500; }
.ex-scard-score.is-pass { color: var(--ex-ok); }
.ex-scard-score.is-fail { color: var(--ex-danger); }
.ex-scard-main { flex: 1 1 auto; min-width: 0; }
.ex-scard-t { font-size: 14.5px; font-weight: 600; margin-bottom: 6px; word-break: break-word; }
.ex-scard-m { display: flex; flex-wrap: wrap; gap: 5px 14px; font-size: 12.5px; color: var(--ex-ink-2); }
.ex-scard-acts { flex: 0 0 auto; display: flex; flex-direction: column; gap: 5px; justify-content: center; }
.ex-review { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ex-line); display: flex; flex-direction: column; gap: 9px; }
.ex-review[hidden] { display: none !important; }
.ex-rv { padding: 11px 13px; border-radius: 10px; background: var(--ex-card-2); border-left: 3px solid var(--ex-line); }
.ex-rv.is-ok { border-left-color: var(--ex-ok); }
.ex-rv.is-no { border-left-color: var(--ex-danger); }
.ex-rv.is-half { border-left-color: var(--ex-warn); }
.ex-rv-h { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 5px; font-size: 12.5px; }
.ex-rv-s { font-size: 13.5px; line-height: 1.7; word-break: break-word; }
.ex-rv-a { font-size: 12.5px; margin-top: 5px; line-height: 1.7; }
.ex-rv-a b { color: var(--ex-ok); }
.ex-rv-a.is-wrong b { color: var(--ex-danger); }
.ex-rv-n { font-size: 12.5px; margin-top: 5px; line-height: 1.7; color: var(--ex-ink-2);
    padding-top: 5px; border-top: 1px dashed var(--ex-line); }

/* ===================== 弹窗 ===================== */
.ex-mask {
    position: fixed; inset: 0; z-index: 120000; display: flex; align-items: center; justify-content: center;
    padding: 20px; background: rgba(8, 12, 18, .58); backdrop-filter: blur(3px);
}
.ex-mask[hidden] { display: none !important; }
.ex-modal {
    width: 100%; max-width: 620px; max-height: 90vh; display: flex; flex-direction: column;
    background: var(--ex-card); border: 1px solid var(--ex-line);
    border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); overflow: hidden;
    animation: ex-modal-in .18s ease;
}
@keyframes ex-modal-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.ex-modal-lg { max-width: 860px; }
.ex-modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 14px 18px; border-bottom: 1px solid var(--ex-line);
}
.ex-modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.ex-modal-body { padding: 18px; overflow-y: auto; overscroll-behavior: contain; }
.ex-modal-foot {
    display: flex; gap: 9px; justify-content: flex-end;
    padding: 13px 18px; border-top: 1px solid var(--ex-line);
}

.ex-seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--ex-card-2); border-radius: 9px; }
.ex-segbtn {
    flex: 1 1 auto; min-width: 62px; height: 32px; border: 0; border-radius: 7px; cursor: pointer;
    background: transparent; color: var(--ex-ink-2);
    font-size: 13px; font-family: inherit; transition: .15s;
}
.ex-segbtn.is-on {
    background: var(--ex-accent); color: #fff; font-weight: 600;
    box-shadow: 0 1px 6px color-mix(in srgb, var(--ex-accent) 28%, transparent);
}

/* 题目编辑：可点击选项行 */
.ex-opts { display: flex; flex-direction: column; gap: 7px; margin-bottom: 9px; }
.ex-opt-row {
    display: flex; align-items: center; gap: 9px;
    padding: 7px 10px; border-radius: 9px; background: var(--ex-card-2);
    border: 1px solid var(--ex-line);
}
.ex-opt-dot {
    flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; padding: 0;
    border: 1px solid var(--ex-line); background: var(--ex-card);
    display: flex; align-items: center; justify-content: center;
    color: transparent; font-size: 12px; font-family: inherit; line-height: 1;
}
.ex-opt-row.is-right .ex-opt-dot { background: var(--ex-ok); border-color: var(--ex-ok); color: #fff; }
.ex-opt-row.is-right { border-color: var(--ex-ok); }
.ex-opt-k { flex: 0 0 auto; font-size: 12.5px; font-weight: 700; color: var(--ex-ink-2); }
.ex-opt-row > .ex-input { flex: 1 1 auto; height: 30px; background: var(--ex-card); }

/* ===================== Toast ===================== */
.ex-toast {
    position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(14px);
    z-index: 200000; max-width: min(460px, 88vw); padding: 11px 18px; border-radius: 10px;
    background: rgba(28, 32, 39, .96); color: #fff; font-size: 13.5px; line-height: 1.5;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .32); opacity: 0; pointer-events: none;
    transition: opacity .22s, transform .22s; text-align: center;
}
.ex-toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }
.ex-toast.is-err { background: rgba(200, 44, 36, .96); }
.ex-toast.is-ok { background: rgba(16, 130, 70, .96); }

/* ============================================================
   响应式 —— 电脑端（大屏增强：列表双列、答题卡加宽）
   ============================================================ */
@media (min-width: 1400px) {
    /* 题库 / 错题本卡片改双列：缩短单行字数、提高屏幕利用率 */
    #exBankList, #exWrongList {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px; align-items: start;
    }
    /* 空状态与「仅显示前 N 题」提示需跨满整行，不能被塞进单个网格单元 */
    #exBankList > .ex-empty, #exWrongList > .ex-empty { grid-column: 1 / -1; }
    .ex-run-body { gap: 18px; }
    .ex-card { flex: 0 0 244px; }
    .ex-q { padding: 24px 26px; }
    .ex-q-stem { font-size: 15.5px; }
    .ex-hero { padding: 26px 28px; }
}

/* ============================================================
   响应式 —— 平板（≤1199px）
   ============================================================ */
@media (max-width: 1199px) {
    .ex-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ex-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

@media (max-width: 991px) {
    .ex-hero { flex-direction: column; gap: 13px; padding: 18px; }
    .ex-hero-text h1 { font-size: 21px; }
    .ex-run-body { flex-direction: column; }
    /* 答题卡在窄屏改为浮层抽屉 */
    .ex-card {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 130000;
        flex: none; width: auto; border-radius: 18px 18px 0 0;
        border-bottom: 0; padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
        /* 第二段超大扩散阴影兼作“遮罩”，让抽屉打开时页面其余部分变暗、视觉更聚焦 */
        box-shadow: 0 -8px 30px rgba(0, 0, 0, .28), 0 0 0 100vmax rgba(8, 12, 18, .42);
        max-height: 72vh; overflow-y: auto; overscroll-behavior: contain;
    }
    .ex-card-grid { grid-template-columns: repeat(8, 1fr); }
    .ex-cbtn { height: 34px; }
    .ex-modal { max-width: 100%; }
    .ex-list-pick { max-height: 40vh; }
}

/* ============================================================
   响应式 —— 手机（≤767px）：更大触控区、底部弹层、操作条吸底
   ============================================================ */
@media (max-width: 767px) {
    .ex-app { font-size: 13.5px; }

    /* 统计条 2 列；第 5 项（奇数且为最后一项）独占整行，避免出现“孤零零”的半行 */
    .ex-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .ex-stats > .ex-stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .ex-stat { padding: 11px 12px; }
    .ex-stat-v { font-size: 19px; }

    .ex-hero { padding: 15px; border-radius: 15px; }
    .ex-hero-icon { width: 48px; height: 48px; border-radius: 13px; }
    .ex-hero-icon svg { width: 25px; height: 25px; }
    .ex-hero-text h1 { font-size: 19px; }
    .ex-hero-text p { font-size: 13px; }

    .ex-tabs { padding: 4px; }
    .ex-tab { height: 40px; padding: 0 14px; font-size: 13.5px; }

    /* 工具条：搜索独占一行，下拉与按钮平分剩余宽度 */
    .ex-bar { gap: 7px; }
    .ex-bar .ex-input[type="search"] { flex: 1 1 100%; }
    .ex-bar .ex-select { flex: 1 1 0; min-width: 0; }
    .ex-bar .ex-btn { flex: 1 1 0; }
    .ex-bar-sub .ex-count { flex: 1 1 100%; }

    /* 触控友好：所有可点元素加大到 ≥36px */
    .ex-btn { height: 40px; padding: 0 14px; font-size: 14px; }
    .ex-btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }
    .ex-icbtn { width: 36px; height: 36px; font-size: 15px; }
    .ex-segbtn { height: 38px; font-size: 13.5px; }
    .ex-opt-dot { width: 26px; height: 26px; }
    .ex-qcard-pick { width: 32px; height: 32px; }

    .ex-grid { grid-template-columns: 1fr; }

    /* 题库 / 错题卡片：操作按钮换行独占一整行，右侧不再拥挤 */
    .ex-qcard { padding: 12px 13px; gap: 10px; flex-wrap: wrap; }
    .ex-qcard-acts { flex: 1 1 100%; flex-direction: row; justify-content: flex-end; gap: 8px; }
    .ex-qcard-stem { font-size: 13.5px; }

    .ex-bp-row { grid-template-columns: 62px 1fr 72px; gap: 7px; }

    /* 答题：头部不吸顶（避免与站点 53px 手机顶栏叠加），底部操作条吸底常驻 */
    .ex-run-head { padding: 10px 12px; gap: 9px; position: static; }
    .ex-run-timer { font-size: 17px; min-width: 78px; padding: 4px 9px; }
    .ex-run-acts { flex: 1 1 100%; }
    .ex-run-acts .ex-btn { flex: 1 1 0; }
    .ex-run-foot {
        position: sticky; bottom: 0; z-index: 15;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -6px 18px rgba(0, 0, 0, .10);
    }
    .ex-run-foot .ex-btn { flex: 1 1 0; height: 42px; }
    .ex-q { padding: 15px 14px; }
    .ex-q-stem { font-size: 14.5px; }
    .ex-qopt { padding: 12px 13px; gap: 10px; }
    .ex-qopt-k { width: 26px; height: 26px; }
    .ex-card-grid { grid-template-columns: repeat(6, 1fr); }
    .ex-cbtn { height: 38px; font-size: 13.5px; }
    .ex-trend-bars { height: 88px; }

    .ex-scard { padding: 12px 13px; gap: 10px; flex-wrap: wrap; }
    .ex-scard-acts { flex: 1 1 100%; flex-direction: row; justify-content: flex-end; gap: 8px; }

    .ex-grid2, .ex-grid3 { grid-template-columns: 1fr; }
    .ex-input, .ex-select, .ex-textarea { font-size: 16px; }  /* 防 iOS 聚焦缩放 */

    /* 弹窗改为底部抽屉（bottom-sheet），单手可达、贴合手机习惯 */
    .ex-mask { align-items: flex-end; padding: 0; }
    .ex-modal {
        max-width: none; width: 100%; max-height: 94vh;
        border-radius: 18px 18px 0 0; border-bottom: 0;
        animation: ex-sheet-up .22s ease;
    }
    @keyframes ex-sheet-up { from { transform: translateY(12%); opacity: .7; } to { transform: none; opacity: 1; } }
    .ex-modal-body { padding: 15px; }
    .ex-modal-foot { padding: 12px 15px calc(12px + env(safe-area-inset-bottom)); }
    .ex-modal-foot .ex-btn { flex: 1 1 0; height: 42px; }

    /* Toast 改为通栏，长文案不再被挤压换行 */
    .ex-toast {
        left: 12px; right: 12px; max-width: none;
        transform: translateY(14px);
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
    .ex-toast.is-on { transform: translateY(0); }
    .ex-list-pick { max-height: 38vh; }
}

@media (max-width: 380px) {
    .ex-card-grid { grid-template-columns: repeat(5, 1fr); }
    .ex-tab { padding: 0 9px; font-size: 12.5px; }
    .ex-hero-tags .ex-tag { font-size: 11.5px; padding: 3px 9px; }
}

/* 横屏矮屏（如手机横放）：压缩纵向留白，保证题目与操作条同屏 */
@media (max-height: 480px) and (orientation: landscape) {
    .ex-hero { padding: 12px 14px; margin-bottom: 10px; }
    .ex-hero-text p { display: none; }
    .ex-stats { margin-bottom: 10px; }
    .ex-run-head, .ex-run-foot { position: static; }
    .ex-modal { max-height: 92vh; }
}

@media (prefers-reduced-motion: reduce) {
    .ex-app *, .ex-app *::before, .ex-app *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* 打印：输出题目清单而非空白页（隐藏页头 / 工具条 / 答题卡等非正文区域） */
@media print {
    body.page-exam-full .ex-hero,
    body.page-exam-full .ex-stats,
    body.page-exam-full .ex-tabs,
    body.page-exam-full .ex-bar,
    body.page-exam-full .ex-toast,
    body.page-exam-full .ex-mask,
    body.page-exam-full .ex-run-head,
    body.page-exam-full .ex-run-foot,
    body.page-exam-full .ex-card,
    body.page-exam-full .ex-run-empty,
    body.page-exam-full .ex-qcard-acts,
    body.page-exam-full .ex-scard-acts { display: none !important; }

    body.page-exam-full .ex-app { max-width: none; margin: 0; }
    /* 打印统一浅色底：避免暗色主题变量在白纸上出现“白底白字” */
    .ex-app {
        --ex-card: #fff; --ex-card-2: #f4f6f8;
        --ex-ink: #0f1419; --ex-ink-2: #536471;
    }
    .ex-pane { display: none !important; }
    .ex-pane.is-on { display: block !important; }
    .ex-qcard, .ex-q, .ex-rv, .ex-scard { break-inside: avoid; }
    .ex-qcard:hover, .ex-pcard:hover { box-shadow: none; }
    .ex-q-stem, .ex-qcard-stem { max-width: none; }
}
