/* ============================================================
   用户端样式 · 唯一来源（无构建工具，不要引入第二套体系）

   设计语言：一张严肃的问卷。细线分层、左对齐、等宽数字、零装饰。
   系统级约定见仓库根目录 design.md；产品级红线见
   docs/用户端UI设计规范.md（圆角 ≤8px、卡片不上阴影、全站唯一渐变是
   顶部 3px 进度条、无 emoji、动效 ≤300ms）。

   品牌色不可更换：深蓝 #032158（主）+ 琥珀 #F39904（强调）。

   注意：本文件是纯 CSS。历史上首行写过 <?php，静态下发时浏览器会把
   <?php 当成 :root 选择器的非法前缀整条丢弃，所有变量失效。不要再加。
   ============================================================ */

:root {
    /* 品牌 */
    --brand:   #032158;
    --brand-2: #0A3577;
    --accent:  #F39904;

    /* 文字。--ink-3 由规范原值 #8A94A6 调深：原值白底仅 3.0:1，
       不满足规范 §8 对辅助文字 4.5:1 的要求；#5F6B80 为 5.4:1 */
    --ink:   #1B2432;
    --ink-2: #4A5568;
    --ink-3: #5F6B80;

    /* 表面 */
    --bg:          #F4F6FA;
    --card:        #FFFFFF;
    --line:        #E3E7EE;
    --line-2:      #EFF2F7;
    --tint:        #F7F9FD;   /* 选中态浅底 */
    --line-strong: #C9D4E4;

    /* 语义（够用即止） */
    --ok:     #2F855A;
    --warn:   #B7791F;
    --danger: #C53030;
    --no:     #7A8699;

    /* 圆角上限 8px；阴影只给弹窗，分层一律用 1px 边框 */
    --r:   8px;
    --r-s: 6px;
    --shadow-modal: 0 4px 20px rgba(16, 26, 48, .12);

    /* 动效：上限 300ms；选中态 0ms 即时 */
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    --dur-fast: 150ms;
    --dur-bar:  200ms;

    /* 字体：规范 §2 固定的系统栈，国内部署不挂 CDN 字体 */
    --font:     -apple-system, BlinkMacSystemFont, "Segoe UI",
                "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── 基础 ─────────────────────────────────────────────── */

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.7;
    -webkit-tap-highlight-color: transparent;
}

/* 浏览器表面也归设计系统管：选区、光标、焦点环、链接下划线偏移 */
::selection { background: rgba(3, 33, 88, .16); }
input, textarea, button { caret-color: var(--brand); }
a { color: var(--brand); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border: 3px solid var(--bg); border-radius: 8px; }

/* ── 顶部栏 ───────────────────────────────────────────── */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.topbar-in {
    max-width: 680px;
    margin: 0 auto;
    padding: 10px 18px;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .02em;
    color: var(--brand);
}
.logo .dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
}
.topinfo {
    margin-left: auto;
    font-size: 13px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.topbar .btn-text { color: var(--brand); font-weight: 500; }
.topbar .btn-text:hover { color: var(--brand-2); }

/* 限时倒计时：只在配置了限时的工具上出现，贴顶栏最右 —— 它是这一页最需要被余光扫到的信息。
   与题号各吃一份 auto 外边距：题号落在中间、倒计时贴最右。
   两个都靠右挤在一起时，余光扫到的是一整串「第 12 / 93 题 19:49」，分不出哪个是时间。
   常态就是 danger 红：限时本身就是压力信息，不需要等最后一分钟才提醒。
   报警只靠颜色与字重递进，不闪烁、不加动画，跟这套文书气质一致 */
.timer {
    flex: none;
    margin-left: auto;
    font-size: 13.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--danger);
    white-space: nowrap;
}
/* 最后一分钟：红色压深一档 + 加粗。tabular-nums 下字重变化不改变数字宽度，不会抖动 */
.timer.warn {
    font-weight: 700;
    color: #9B2C2C;
}

/* 进度条：全站唯一允许的渐变（进度语义，非装饰） */
.progress { height: 3px; background: var(--line-2); overflow: hidden; }
.progress > span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--brand), var(--accent));
    transition: width var(--dur-bar) var(--ease-out);
}

/* ── 容器 ─────────────────────────────────────────────── */

.wrap        { max-width: 680px; margin: 0 auto; padding: 0 18px; }
.wrap-narrow { max-width: 520px; margin: 0 auto; padding: 0 18px; }

/* 顶对齐入口：表单不做垂直居中，居中是落地页套路 */
.entry { padding-top: max(40px, 8vh); padding-bottom: 64px; }

/* ── 页头（全站统一的标题节奏：细分隔线收头） ─────────── */

.form-head {
    padding: 26px 0 14px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--line-2);
}
.form-head h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.3px;
    line-height: 1.4;
    color: var(--brand);
}
.form-head .sub { margin-top: 4px; font-size: 13px; color: var(--ink-3); }

/* 标题下的工具说明（入口页）：比 meta 深一档、比 meta 大一档。
   它是这一页唯一解释「这套测评测什么」的地方，所以要能读，不能只当标签；
   题量与时长跟在它后面收口，构成「是什么 → 多大」的先后。 */
.form-head .lead {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.75;
    color: var(--ink-2);
}
.form-head .lead + .sub { margin-top: 14px; }

/* ── 面板（入口页 / 错误页） ──────────────────────────── */

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 26px 24px 24px;
}
.panel .form-head { padding-top: 0; padding-bottom: 16px; margin-bottom: 18px; }

/* ── 表单 ─────────────────────────────────────────────── */

.field { margin-top: 18px; }
.field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
}
.field input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 15px;   /* 15px 配固定 viewport，不触发 iOS 聚焦缩放 */
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-s);
    transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(3, 33, 88, .10);
}
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(197, 48, 48, .10); }

/* 错误提示走输入框下方，不用弹窗 */
.field .err { display: none; margin-top: 6px; font-size: 13px; font-weight: 500; color: var(--danger); }
.field .err.show { display: block; }

.hint { margin-top: 14px; text-align: center; font-size: 12px; color: var(--ink-3); }

/* ── 按钮 ─────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 24px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    color: var(--card);
    background: var(--brand);
    border: 1px solid var(--brand);
    border-radius: var(--r-s);
    cursor: pointer;
    transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease,
                transform 80ms ease;
}
.btn:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-ghost { color: var(--brand); background: var(--card); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--tint); border-color: var(--brand); }

.btn-text {
    height: auto;
    min-height: 32px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 400;
    color: var(--ink-3);
    background: transparent;
    border: none;
}
.btn-text:hover { color: var(--ink); background: transparent; }

.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #9B2C2C; border-color: #9B2C2C; }

.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; }
.btn-block { width: 100%; }

/* ── 空状态 ───────────────────────────────────────────── */

.empty { margin-top: 20px; font-size: 14px; color: var(--ink-2); }
.empty-actions { margin-top: 18px; }

/* ── 首页：工具索引（细线选择列表，整行即链接）───────────
   三十多个工具纵向排下来是四五屏的滚动，所以宽屏折成双列索引：
   名字吃左边、题量与时长贴右边、说明压到两行 —— 扫读的眼睛只走竖线。
   行线用 border-top 收（不用 border-bottom）：工具数为奇数时，
   末尾不会留下一条只有左列有、右列空着的横线。 */

.tool-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
/* 脚本没跑起来时整块收起，不留一个按了没反应的输入框 */
.tool-filter[hidden] { display: none; }

.tool-filter input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    font-family: inherit;
    font-size: 15px;   /* 与入口页输入框同字号，iOS 聚焦不缩放 */
    color: var(--ink);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-s);
    transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.tool-filter input::placeholder { color: var(--ink-3); }
.tool-filter input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(3, 33, 88, .10);
}
/* 浏览器自带的清除叉是 UA 蓝，跟这套配色不合：换成同色系的细叉，
   只保留「有内容才出现」这一条原生行为 */
.tool-filter input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background-color: var(--ink-3);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 2l10 10M12 2L2 12' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 2l10 10M12 2L2 12' stroke='%23000' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
    cursor: pointer;
}
.tool-filter input::-webkit-search-cancel-button:hover { background-color: var(--brand); }

/* 计数：数字对齐、右贴边，筛选前后不跳动 */
.tool-count {
    flex: none;
    margin-left: auto;        /* 计数贴内容右边缘，与右列的「题量时长」同一竖线 */
    min-width: 4.5em;
    text-align: right;
    font-size: 13px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tool-list { display: grid; grid-template-columns: 1fr; }
/* 一行 = 左侧 20px 的图标沟槽 + 一列文字。
   图标挂在沟槽里（跨两行），名称与说明共用同一条左边缘 —— 缩进的只有图标，
   文字列不被推得参差。 */
.tool-row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    column-gap: 12px;
    align-content: start;
    margin: 0 -10px;          /* 底色与行线越过文字两端，文字仍与页头对齐 */
    padding: 12px 10px 13px;
    border-top: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}
.tool-icon {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 20px;
    height: 20px;
    margin-top: 2px;          /* 与 16px 名称的中线对齐 */
    color: var(--ink-3);
}
.tool-row[hidden] { display: none; }
/* hover 过渡只声明在 :hover 里：进入有过渡，离开即恢复 */
.tool-row:hover { background: var(--card); transition: background-color var(--dur-fast) ease; }
.tool-row:focus-visible { outline-offset: -2px; }

/* 名称与体量同一行：右侧的「198 题 · 约 15 分钟」像目录的页码，靠右成一列 */
.tool-head { grid-column: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.tool-name {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: -.2px;
    color: var(--ink);
}
.tool-meta {
    margin-left: auto;        /* 换行时也靠右，不与名称挤成一段 */
    font-size: 13px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
/* 说明只留两行：这一页是索引，一行工具读一句就够；长说明截断，
   换来的是每一行高度接近，扫读时才成一条竖线 */
.tool-desc {
    grid-column: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-2);
}

.tool-none { padding: 20px 0 2px; font-size: 14px; color: var(--ink-2); }

/* 宽屏：索引折成两列。680 的阅读列是给答题页的，索引页不需要那么窄 */
@media (min-width: 820px) {
    .wrap-index { max-width: 1000px; }
    .topbar-wide .topbar-in { max-width: 1000px; }
    .tool-list { grid-template-columns: 1fr 1fr; column-gap: 44px; }
}

/* ── 答题页 ───────────────────────────────────────────── */

/* 内容区吃满「顶栏 ↔ 底部条」之间的剩余高度：
   ① 一屏只有一道题，题干居中才不显得头重脚轻
   ② sticky 只在容器比视口高时才能吸住底边，底部条要贴底就得让内容区先撑满 */
body:has(#quiz-root) { display: flex; flex-direction: column; min-height: 100vh; }
body:has(#quiz-root) #quiz-root {
    flex: 1;
    /* 必须显式给宽度：flex 项上的 margin:auto 会让它按内容收缩，
       680 的列会缩成一条窄柱（正文与选项全挤在中间） */
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
/* 两个空占位块把剩余高度按 1:3 分掉 —— 题干落在正中偏上，
   而不是死死居中（居中的话下方空太多，题干显得往下坠）。
   等比缩放：窗口越高，空白越多，比例不变 */
body:has(#quiz-root) #quiz-root::before { content: ''; flex: 1 0 0; }
body:has(#quiz-root) #quiz-root::after  { content: ''; flex: 3 0 0; }

.question, .self-rating { display: none; }
.question.on, .self-rating.on {
    display: block;
    animation: qIn var(--dur-fast) var(--ease-out);
}
@keyframes qIn { from { opacity: 0; } to { opacity: 1; } }

/* 题干短，上下留白对称 —— 居中后内容真的落在中间 */
.question { padding: 28px 0; }
/* 自评区比视口高，本来就没有居中可言；留出底部条的高度，滚动时不压内容 */
.self-rating { padding: 28px 0 72px; }

.q-section { margin-bottom: 8px; font-size: 13px; font-weight: 500; color: var(--ink-3); }
.q-content {
    font-size: 17px;
    /* 题干加粗 + 纯黑：一屏只有一道题，题干要压得住，选项是次级灰 */
    font-weight: 600;
    line-height: 1.7;
    letter-spacing: -.2px;
    color: #000;
    /* MBTI 是二选一题干，A、B 两句靠换行分开；霍兰德单行加了无变化 */
    white-space: pre-line;
}

/* 选项 = 选票式细线列表：强外沿 + 轻内隔线，不用一叠卡片盒 */
.q-options { margin-top: 22px; border: 0; padding: 0; border-top: 1px solid var(--line); }
.q-option {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--line-2);
    font-size: 15px;
    color: var(--ink-2);
    cursor: pointer;
}
.q-option:last-child { border-bottom: 0; }
.q-option:hover { background: var(--card); transition: background-color var(--dur-fast) ease; }
.q-option.on {
    background: var(--tint);
    box-shadow: inset 0 0 0 1px var(--brand);
    color: var(--ink);
}
.q-option.on span { font-weight: 500; }

.q-option input[type="radio"] {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--brand);
    cursor: pointer;
}

/* ── 保存失败提示条 ───────────────────────────────────── */

.save-banner {
    position: sticky;
    top: 53px;
    z-index: 40;
    display: none;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #8A5A00;
    background: #FFF8E8;
    border-bottom: 1px solid #F0D9A0;
}
.save-banner.show { display: block; }

/* ── 底部操作条 ───────────────────────────────────────── */

.action-bar {
    position: sticky;
    bottom: 0;
    z-index: 45;
    background: var(--card);
    border-top: 1px solid var(--line);
}
/* 条子满宽，内容与正文同宽同列 —— 整页读起来是一根居中的列，
   而不是「正文居中、底栏两头贴边」的两套对齐 */
.action-bar-in {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 60px;
    padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
}
.action-bar .btn-text { display: inline-flex; align-items: center; min-height: 36px; }
.action-hint { margin-left: auto; font-size: 13px; color: var(--ink-3); }
/* 交卷按钮一亮出来，右侧那句状态说明就是冗余的 */
.action-bar:has(#submit-final.show) .action-hint { display: none; }

#submit-final { display: none; }
#submit-final.show { display: inline-flex; }

/* 「上一题」任何时刻都可点（首题由 JS 整颗隐藏）：
   曾经是「5 秒内才点亮」，窗口一过按钮只变色、点了没反应，用户只会当成 bug */
#btn-prev { color: var(--brand); cursor: pointer; }
#btn-prev:hover { color: var(--brand-2); }

/* ── 自评（分段量表，12 项也不拉长页面） ───────────────── */

.self-grid {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}
.self-item {
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px 16px 16px;
    margin: 0;
    background: var(--card);
}
.self-item legend { padding: 0; font-size: 14px; font-weight: 500; color: var(--ink); }
.self-rating .q-content { font-size: 17px; font-weight: 500; }
.self-rating .q-section { margin: 6px 0 0; }

.self-scale {
    display: flex;
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-s);
    overflow: hidden;
    background: var(--card);
}
.self-opt {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 2px;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
    color: var(--ink-2);
    cursor: pointer;
}
.self-opt + .self-opt { border-left: 1px solid var(--line-2); }
/* radio 保持可聚焦可读屏，只是不画出来 */
.self-opt input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.self-opt:has(input:checked) { background: var(--tint); color: var(--brand); font-weight: 500; }
.self-opt:has(input:focus-visible) { box-shadow: inset 0 0 0 2px var(--brand); }

/* ── 进度页：ledger 行 ────────────────────────────────── */

.pc-list { margin-top: 4px; border-top: 1px solid var(--line); }
.pc-row { padding: 18px 4px; border-bottom: 1px solid var(--line); }
.pc-row:last-child { border-bottom: 0; }
.pc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pc-title { font-size: 16px; font-weight: 600; letter-spacing: -.2px; color: var(--ink); }
.pc-count { flex: none; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pc-meta { margin-top: 2px; font-size: 13px; color: var(--ink-3); }
.pc-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.pc-progress .progress { flex: 1; }
.pc-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.pc-restart { color: var(--ink-3); }
.pc-restart:hover { color: var(--danger); }

/* ── 完成页 ───────────────────────────────────────────── */

/* 这一页必须安静：留白 + 纯文字 + 一张信息表，不加任何庆祝元素 */
.done-wrap { padding: 72px 18px 60px; text-align: center; }
/* 全页唯一的品牌强调：标题上方一条 36px 琥珀线，像公文落款 */
.done-mark { width: 36px; height: 2px; margin: 0 auto 22px; background: var(--accent); }
.done-main h1 { font-size: 20px; font-weight: 600; letter-spacing: -.3px; color: var(--brand); }
.done-lead { margin-top: 8px; font-size: 15px; color: var(--ink-2); }

.done-info {
    width: 100%;
    max-width: 400px;
    margin: 36px auto 0;
    border-collapse: collapse;
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--card);
    text-align: left;
}
.done-info th, .done-info td { padding: 11px 16px; font-size: 14px; border-bottom: 1px solid var(--line-2); }
.done-info tr:last-child th, .done-info tr:last-child td { border-bottom: 0; }
/* 标签列宽度交给内容，不写死：
   「测评工具」「提交时间」都是 4 字标签，14px 下约 56px，加上左右各 16px 内边距正好 88px ——
   写死 88px 时字体渲染差一点点就折成「测评工 / 具」。
   width:1% + nowrap 是这里要的组合：列宽收缩到"刚好放下不折行"。 */
.done-info th {
    width: 1%;
    font-weight: 400;
    color: var(--ink-3);
    background: var(--bg);
    white-space: nowrap;
}
.done-info td { color: var(--ink); }
/* 测试码是家长向老师核对的凭证，等宽 + 放宽字距 */
.done-info code {
    font-family: var(--font-mono);
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: .06em;
    color: var(--ink);
}
/* 联系手机号：与信息表同宽（400px），但左对齐 ——
   表格里是「标签 : 值」的居中语境，输入框左对齐才好填。
   只有一行输入 + 一个 ghost 按钮：这页的主角是上面那句「请联系老师」（规范 §4.5）。 */
.done-contact {
    max-width: 400px;
    margin: 22px auto 0;
    text-align: left;
}
.done-contact .field { margin-top: 0; }
.done-contact-row { display: flex; align-items: center; gap: 8px; }
/* width:auto 覆盖 .field input 的 100%：百分比宽度会让 flex 基准撑破容器 */
.done-contact-row input { width: auto; flex: 1 1 0; min-width: 0; }
.done-contact-row .btn { flex: none; padding: 0 18px; }
.done-contact-msg {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--ink-3);
}
/* 状态类名刻意不叫 .err / .ok：.field .err 是表单错误行（display:none，
   靠 .show 打开），同名会让这行提示在错误状态下直接被藏起来 */
.done-contact-msg.is-ok  { color: var(--ok); }
.done-contact-msg.is-err { color: var(--danger); }

.done-note { margin-top: 26px; font-size: 13px; color: var(--ink-3); }

/* 出口：右下角纯文本「返回」，回工具选择页。
   与信息表右边缘对齐（max-width 跟表格一致），而不是贴屏幕右下角 ——
   宽屏下后者会飘到离内容很远的角落。
   用品牌色而不是 .btn-text 默认的 ink-3：它是这一页唯一可点的东西，
   弱到看不见等于没加；做法与顶栏「返回」一致（同一功能的同一样子）。 */
.done-foot {
    max-width: 400px;
    margin: 14px auto 0;
    text-align: right;
}
.done-foot .btn-text { color: var(--brand); text-decoration: none; }
.done-foot .btn-text:hover { color: var(--brand-2); }

/* ── 错误页（layouts/blank 与 quiz-error 共用） ────────── */

.err-page { max-width: 520px; margin: 0 auto; padding: max(40px, 8vh) 18px 64px; }
.err-page h1 { font-size: 20px; font-weight: 600; letter-spacing: -.3px; color: var(--brand); }
.err-page p { margin-top: 8px; font-size: 15px; color: var(--ink-2); }
.err-page .btn { margin-top: 22px; }

/* ── 综合选科结论 ─────────────────────────────────────── */

.subject-wrap { max-width: 640px; margin: 0 auto; padding: 56px 18px 64px; }
.subject-head h1 { font-size: 20px; font-weight: 600; letter-spacing: -.3px; color: var(--brand); }
.subject-lead { margin-top: 10px; font-size: 14px; line-height: 1.7; color: var(--ink-2); }

.subject-block { margin-top: 34px; }
.subject-block > h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--brand);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.subject-hint { margin-top: 10px; font-size: 13px; line-height: 1.6; color: var(--ink-3); }

/* 信息表复用完成页的样式骨架（同为「标签 + 值」），
   宽度放到 100% 而不是 400px：这一页一屏放两块内容，窄表会逼出大量折行 */
.subject-info {
    width: 100%;
    margin-top: 14px;
    border-collapse: collapse;
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
    background: var(--card);
    text-align: left;
}
.subject-info th, .subject-info td {
    padding: 11px 16px;
    font-size: 14px;
    line-height: 1.6;
    border-bottom: 1px solid var(--line-2);
    vertical-align: top;
}
.subject-info tr:last-child th, .subject-info tr:last-child td { border-bottom: 0; }
.subject-info th {
    width: 1%;
    font-weight: 400;
    color: var(--ink-3);
    background: var(--bg);
    white-space: nowrap;
}
.subject-info td { color: var(--ink); }

/* 两条可行方向：不用色块区分主次，
   一条细边 + 一个文字标签就够了 —— 色块会让「备选」看起来像被否掉 */
.subject-lines { margin-top: 16px; }
.subject-lines h3 { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.subject-line {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 8px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--card);
    font-size: 14px;
}
.subject-line.is-primary { border-left: 2px solid var(--accent); }
.subject-line-name { font-weight: 600; color: var(--ink); }
.subject-line-score { font-size: 13px; color: var(--ink-3); }
.subject-line-tag {
    margin-left: auto;
    font-size: 12px;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 2px;
    padding: 1px 6px;
}

/* 判断条件 / 说明：一组有序的短句，是「结论凭什么」的落点 */
.subject-conditions { margin-top: 16px; }
.subject-conditions h3 { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.subject-conditions ul, .subject-warnings ul, .subject-disclaimer ul {
    margin-top: 8px;
    padding-left: 18px;
    font-size: 13.5px;
    line-height: 1.8;
    color: var(--ink-2);
}

.subject-second {
    width: 100%;
    margin-top: 14px;
    border-collapse: collapse;
    border: 1px solid var(--line);
    font-size: 14px;
}
.subject-second th, .subject-second td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--line-2);
    text-align: left;
}
.subject-second thead th { font-weight: 500; color: var(--ink-3); background: var(--bg); }
.subject-second tbody tr:last-child td { border-bottom: 0; }
.subject-second td:nth-child(2) { font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* 提示块：不是警告框，只是一块需要多读两句的补充说明 */
.subject-note {
    margin-top: 14px;
    padding: 12px 16px;
    border-left: 2px solid var(--line);
    background: var(--bg);
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--ink-2);
}
.subject-note ul { margin-top: 6px; padding-left: 18px; }

.subject-disclaimer { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); }
.subject-disclaimer h2 { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.subject-disclaimer ul { margin-top: 8px; padding-left: 18px; font-size: 13px; color: var(--ink-3); }

.subject-wrap .done-foot { max-width: none; margin-top: 26px; }

/* ── 图表 ─────────────────────────────────────────────────────────
   左右并排：flex + wrap，窄屏自动折成上下。
   两张卡片的 margin 归零，间距交给 gap，不然会叠成两倍。 */
.chart-pair { display: flex; flex-wrap: wrap; gap: 14px 20px; margin: 0 0 14px; }
.chart-pair > .chart-card { flex: 1 1 340px; min-width: 0; margin: 0; }
.chart-pair.solo > .chart-card { flex: 1 1 100%; }

/* SVG 由 SvgChart 生成，类名在那里定义；这里只保证它在本页不溢出 */
.chart-card svg { display: block; max-width: 100%; height: auto; }

.subject-ai {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.85;
    color: var(--ink);
}
.subject-ai h2 { margin-top: 22px; font-size: 16px; font-weight: 600; color: var(--brand); }
.subject-ai h3 { margin-top: 18px; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.subject-ai p { margin-top: 10px; }
.subject-ai ul, .subject-ai ol { margin-top: 8px; padding-left: 20px; }
.subject-ai li { margin-top: 5px; }
.subject-ai strong { font-weight: 600; }
.subject-ai table { width: 100%; margin-top: 12px; border-collapse: collapse; font-size: 13px; }
.subject-ai th, .subject-ai td { padding: 7px 10px; border: 1px solid var(--line-2); text-align: left; }
.subject-ai th { background: var(--bg); font-weight: 500; color: var(--ink-3); }

.subject-ai-empty { margin-top: 12px; }
.subject-ai-empty .btn { margin-top: 10px; }
.subject-ai-empty .field-hint { margin-top: 8px; font-size: 12.5px; color: var(--ink-3); }
.err-page pre {
    margin-top: 16px;
    padding: 12px;
    font-size: 12px;
    color: var(--ink-2);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-s);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── 工具类 ───────────────────────────────────────────── */

.hide { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── 模态框（全站唯一允许投影的地方，规范 §2.2）───────── */

.modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 18px;
}
/* 作者样式里的 display:flex 会盖掉 UA 的 [hidden]，必须显式收回去 */
.modal[hidden] { display: none; }

.modal-backdrop { position: absolute; inset: 0; background: rgba(16, 26, 48, .45); }

.modal-box {
    position: relative;
    width: 100%;
    max-width: 380px;
    padding: 22px 22px 20px;
    background: var(--card);
    border-radius: var(--r);
    box-shadow: var(--shadow-modal);
    animation: modalIn var(--dur-bar) var(--ease-out);
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.modal-title { font-size: 16px; font-weight: 600; letter-spacing: -.2px; color: var(--ink); }
.modal-desc { margin-top: 8px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
/* 超时倒数里的数字：大一号 + danger 色，扫一眼就知道还剩几下 */
.modal-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ── 无障碍：动效熔断 ─────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ── 窄屏（<375px）：分段量表缩字号，五项不折行 ───────── */

@media (max-width: 374px) {
    .self-opt { font-size: 11px; padding: 9px 1px; }
}
