/* 答题系统 · 麦芽琥珀 */
:root {
    --bg: #f7f4ee;
    --card: #fdfbf7;
    --raised: #efe9df;
    --line: rgba(31, 27, 22, .10);
    --line2: rgba(31, 27, 22, .18);
    --text: #1f1b16;
    --text2: #5e554a;
    --muted: #7b7266;
    --accent: #b45309;
    --accent-h: #92400e;
    --accent-soft: #f3e7d3;
    --ok: #16a34a;
    --ok-soft: #e8f5ec;
    --bad: #dc2626;
    --bad-soft: #fdeeee;
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
    --ease: cubic-bezier(.22, 1, .36, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.65 -apple-system, "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
    font-variant-numeric: tabular-nums;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
.main { padding: 24px 20px 72px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
::selection { background: var(--accent-soft); }

/* ---- 顶栏 ---- */
.topnav {
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.navrow { display: flex; align-items: center; gap: 20px; height: 52px; }
.brand {
    font-weight: 600; font-size: 15px; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 8px;
}
.brand::before {
    content: ""; width: 9px; height: 9px; border-radius: 2px;
    background: var(--accent); flex: none;
}
.navrow a { color: var(--text2); text-decoration: none; font-size: 14px; white-space: nowrap; transition: color .15s var(--ease); }
.navrow a:hover { color: var(--accent); }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 13px; }

/* ---- 卡片 ---- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
}
.narrow { max-width: 380px; margin: 48px auto; }
.wide-form { max-width: 560px; }
.empty { color: var(--muted); text-align: center; padding: 28px 0; }
h2 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
h3 { margin: 8px 0; font-size: 15px; font-weight: 500; }

/* ---- 提示条 ---- */
.flash { border-radius: 10px; padding: 10px 16px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: var(--ok-soft); color: #14532d; border: 1px solid rgba(22, 163, 74, .25); }
.flash.bad { background: var(--bad-soft); color: #991b1b; border: 1px solid rgba(220, 38, 38, .25); }
.flash.warn { background: #faf3e0; color: #92400e; border: 1px solid rgba(180, 83, 9, .25); }

/* ---- 表单 ---- */
label { display: block; margin: 12px 0 6px; color: var(--text2); font-size: 13px; }
input, select, textarea {
    width: 100%; padding: 8px 12px;
    border: 1px solid var(--line2); border-radius: 8px;
    font: inherit; color: var(--text); background: #fff;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; }
.checkline {
    display: flex; align-items: flex-start; gap: 10px;
    color: var(--text); font-size: 14px; margin: 10px 0; cursor: pointer;
}
.checkline input { width: auto; margin-top: 3px; }
.modecard {
    border: 1px solid var(--line); border-radius: 10px;
    padding: 14px 16px; margin: 10px 0;
    transition: border-color .15s var(--ease);
}
.modecard:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 20px; }
.grid2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 640px) {
    .grid2, .grid3, .grid2-col { grid-template-columns: 1fr; }
}

/* ---- 按钮 ---- */
.btn {
    display: inline-block; padding: 8px 18px;
    border: 1px solid var(--line2); border-radius: 8px;
    background: var(--card); color: var(--text);
    font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
    transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-h); border-color: var(--accent-h); color: #fff; }
.btn.big { padding: 12px 36px; font-size: 16px; }
.btn.block { width: 100%; margin-top: 16px; }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn.ghost {
    background: rgba(253, 251, 247, .88);
    border-color: rgba(31, 27, 22, .18);
    color: var(--text);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.linkbtn {
    background: none; border: none; padding: 0;
    color: var(--accent); cursor: pointer; font: inherit; font-size: 14px;
}
.linkbtn:hover { color: var(--accent-h); }
.linkbtn.bad { color: var(--bad); }
.linkbtn.bad:hover { color: #991b1b; }

/* ---- 表格 ---- */
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td {
    text-align: left; padding: 10px 12px;
    border-bottom: 1px solid var(--line); vertical-align: top;
}
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: none; }
.small { font-size: 12px; color: var(--muted); }
.ops { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.ops form { display: inline; }
.filterrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filterrow input, .filterrow select { width: auto; }
.inlinerow { display: flex; gap: 8px; align-items: center; }
.inlinerow input { width: auto; }

/* ---- 徽章（安静版：发丝线 + 色点） ---- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 1px 10px; border-radius: 20px;
    font-size: 12px; color: var(--text2);
    border: 1px solid var(--line2); background: transparent;
}
.badge::before {
    content: ""; width: 6px; height: 6px; border-radius: 2px;
    background: var(--muted); flex: none;
}
.badge.ok { color: #166534; border-color: rgba(22, 163, 74, .35); }
.badge.ok::before { background: var(--ok); }
.badge.bad { color: #991b1b; border-color: rgba(220, 38, 38, .35); }
.badge.bad::before { background: var(--bad); }
.badge.muted { color: var(--muted); }
.badge.type-single::before { background: var(--accent); }
.badge.type-multi::before { background: var(--ok); }
.badge.type-judge::before { background: #7b7266; }
.badge.st-open { color: #166534; border-color: rgba(22, 163, 74, .35); }
.badge.st-open::before { background: var(--ok); }
.badge.st-closed { color: #991b1b; border-color: rgba(220, 38, 38, .35); }
.badge.st-closed::before { background: var(--bad); }
.badge.st-draft { color: var(--muted); }

/* ---- 概览统计 ---- */
.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat {
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 16px; text-align: center;
}
.stat b {
    display: block; font-size: 28px; font-weight: 500;
    font-family: var(--mono); font-variant-numeric: tabular-nums;
    color: var(--text); line-height: 1.2;
}
.stat:first-child b { color: var(--accent); }
.stat span { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) { .statrow { grid-template-columns: 1fr 1fr; } }

/* ---- 考试列表 ---- */
.exam-item .exam-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.exam-item h3 { margin: 0; font-size: 16px; }
.meta {
    display: flex; flex-wrap: wrap; gap: 6px 20px;
    color: var(--muted); font-size: 13px; margin-top: 8px;
}
.center-meta { justify-content: center; }

/* ---- 答题页 ---- */
.exam-top {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.exam-top h2 { margin: 0; font-size: 18px; }
#remain { font-size: 17px; font-family: var(--mono); }
#remain.danger, .badtext { color: var(--bad); }
.good { color: var(--ok); }

.q {
    border: 1px solid var(--line); border-radius: 12px;
    padding: 14px 18px; margin: 0 0 14px; background: var(--card);
}
.q legend { font-weight: 500; padding: 0 6px; }
.q legend::before {
    content: ""; display: inline-block; width: 8px; height: 8px;
    border-radius: 2px; background: var(--accent);
    margin-right: 8px; vertical-align: 1px;
}
.opt {
    display: block; padding: 8px 12px; margin: 4px 0;
    border-radius: 8px; cursor: pointer;
    transition: background .15s var(--ease);
}
.opt:hover { background: var(--accent-soft); }
.opt input { width: auto; margin-right: 8px; }
.opt.right { background: var(--ok-soft); color: #14532d; }
.opt.wrong { background: var(--bad-soft); color: #991b1b; }
.ansline { margin-top: 10px; }
.expl {
    margin-top: 8px; padding: 10px 14px;
    background: var(--raised); border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0; color: var(--text2); font-size: 14px;
}
.submitbar { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.hint { color: var(--muted); font-size: 13px; }

/* ---- 成绩页 ---- */
.score-big { font-size: 56px; font-weight: 500; line-height: 1.1; font-family: var(--mono); }
.score-big small { font-size: 20px; color: var(--muted); }
.center { text-align: center; }

/* ---- 刷题 ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
    padding: 4px 14px; border-radius: 20px;
    background: var(--card); border: 1px solid var(--line2);
    color: var(--text2); text-decoration: none; font-size: 13px;
    transition: all .15s var(--ease);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.stem { margin: 10px 0; font-size: 16px; }
.opts .opt { border: 1px solid var(--line); }
.opts .opt.picked { border-color: var(--accent); background: var(--accent-soft); }
.opts .opt.right { border-color: var(--ok); }
.opts .opt.wrong { border-color: var(--bad); }
.opts .opt:disabled { cursor: default; }
.pbar { display: flex; gap: 12px; margin-top: 16px; }
#feedback { margin-top: 12px; }
.errlist { color: var(--bad); }

/* ---- 组卷选题 ---- */
.pickhead { margin: 16px 0 6px; font-size: 14px; color: var(--text2); }
.picklist {
    max-height: 220px; overflow-y: auto;
    border: 1px solid var(--line); border-radius: 8px; padding: 8px;
}
.pickitem {
    display: block; padding: 4px 6px; margin: 0;
    color: var(--text); font-size: 14px; cursor: pointer; border-radius: 6px;
}
.pickitem:hover { background: var(--accent-soft); }
.pickitem input { width: auto; margin-right: 8px; }

/* ---- 设置页：背景色板 ---- */
.swatches { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 4px; }
.swatch {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    cursor: pointer; font-size: 12px; color: var(--text2); margin: 0;
    width: 76px;
}
.swatch input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch-chip {
    width: 64px; height: 40px; border-radius: 8px;
    border: 1px solid var(--line2); overflow: hidden; display: block;
    transition: box-shadow .15s var(--ease);
}
.swatch.on { color: var(--accent); font-weight: 500; }
.swatch.on .swatch-chip { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.swatch-img {
    display: flex; align-items: center; justify-content: center;
    background: var(--raised); color: var(--muted); font-size: 13px;
}

/* ---- 自由答题（投屏） ---- */
.free-body { min-height: 100vh; }
.free-corner {
    position: fixed; top: 16px; right: 20px; z-index: 40;
    display: flex; align-items: center; gap: 10px;
    background: rgba(253, 251, 247, .88);
    border: 1px solid rgba(31, 27, 22, .14);
    border-radius: 10px; padding: 6px 10px;
    backdrop-filter: blur(4px);
}
.free-brand { font-size: 13px; color: var(--text2); margin-right: 4px; }
.free-stage {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 10vh 16vw 8vh;
}
.free-panel {
    width: 100%;
    background: rgba(253, 251, 247, .55);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-radius: 24px; padding: 56px 64px;
}
.free-start { text-align: center; }
.free-title { font-size: clamp(44px, 6vw, 84px); font-weight: 500; letter-spacing: -.01em; }
.free-title::before {
    content: ""; display: inline-block; width: 14px; height: 14px;
    border-radius: 3px; background: var(--accent);
    margin-right: 16px; vertical-align: 6px;
}
.free-sub { color: var(--text2); font-size: 17px; margin-top: 12px; font-family: var(--mono); }
.free-go {
    display: inline-block; margin-top: 32px; padding: 10px 28px;
    border: 1px solid var(--line2); border-radius: 24px;
    color: var(--text2); font-size: 15px;
}
.free-qhead {
    display: flex; align-items: baseline; gap: 16px; margin-bottom: 20px;
}
.free-no {
    font-family: var(--mono); font-size: 15px; color: var(--muted);
    display: inline-flex; align-items: center; gap: 8px;
}
.free-no::before {
    content: ""; width: 10px; height: 10px; border-radius: 2px;
    background: var(--accent); flex: none;
}
.free-tag { font-size: 13px; color: var(--muted); }
.free-stem {
    font-size: clamp(34px, 4.6vw, 62px); line-height: 1.3;
    font-weight: 500; margin-bottom: 34px;
}
.free-opts { display: flex; flex-direction: column; gap: 12px; }
.free-opt {
    display: flex; align-items: baseline; gap: 18px;
    padding: 18px 30px; border: 1px solid var(--line2); border-radius: 12px;
    font-size: clamp(22px, 2.8vw, 38px); line-height: 1.45;
    transition: opacity .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.free-letter {
    font-family: var(--mono); font-weight: 600; color: var(--accent);
    flex: none; min-width: 1.2em;
}
.free-opt.right { border-color: var(--ok); background: var(--ok-soft); }
.free-opt.right .free-letter { color: var(--ok); }
.free-opt.dim { opacity: .42; }
.free-ansline { margin-top: 28px; font-size: 28px; }
.free-ansline b { color: var(--ok); }
.free-expl {
    margin-top: 14px; padding: 14px 20px;
    background: var(--raised); border-left: 3px solid var(--accent);
    border-radius: 0 10px 10px 0;
    color: var(--text2); font-size: 22px; line-height: 1.6;
}
.free-end { text-align: center; }
.free-hint {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(253, 251, 247, .88);
    border: 1px solid rgba(31, 27, 22, .14);
    border-radius: 20px; padding: 6px 18px;
    color: var(--muted); font-size: 13px; white-space: nowrap;
    backdrop-filter: blur(4px); z-index: 40;
}
#free-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: var(--accent); z-index: 50;
    transition: width .25s var(--ease);
}

/* ---- 响应式 ---- */
@media (max-width: 640px) {
    .free-stage { padding: 72px 16px 64px; }
    .free-panel { padding: 28px 22px; }
    .free-title { font-size: 32px; }
    .free-corner { top: 10px; right: 10px; }
    .free-hint { display: none; }
}


/* ---- 多题库与自由模式选择页 ---- */
.free-home {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 24px;
    padding: 88px 24px 72px;
}
.free-setlist { display: flex; flex-direction: column; gap: 12px; width: min(560px, 92vw); }
.free-setcard {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    background: rgba(253, 251, 247, .94);
    border: 1px solid var(--line); border-radius: 12px;
    padding: 18px 26px; text-decoration: none; color: var(--text);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.free-setcard:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.free-setname { font-size: 18px; font-weight: 500; }
.free-setmeta { font-size: 13px; color: var(--muted); font-family: var(--mono); }
.delbtn.armed { color: #fff; background: var(--bad); border-radius: 6px; padding: 2px 10px; }


/* ---- 抽题板（号题绑定） ---- */
.free-boardwrap { width: 100%; max-width: 1000px; }
.free-boardhead {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 26px;
}
.free-boardhead .free-title { font-size: clamp(28px, 3.4vw, 48px); }
.free-boardhead .free-sub { margin-top: 8px; }
.free-board {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 14px;
}
.free-tile {
    aspect-ratio: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 4px;
    background: rgba(253, 251, 247, .92);
    border: 1px solid var(--line2); border-radius: 14px;
    text-decoration: none; color: var(--text);
    transition: border-color .15s var(--ease), transform .15s var(--ease);
}
a.free-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.free-tileno { font-family: var(--mono); font-size: clamp(26px, 3vw, 40px); font-weight: 500; }
.free-tiletag { font-size: 12px; color: var(--muted); }
.free-tile.taken { background: rgba(31, 27, 22, .05); border-style: dashed; cursor: not-allowed; }
.free-tile.taken .free-tileno { text-decoration: line-through; color: var(--muted); }
.free-showbar { display: flex; align-items: center; gap: 18px; margin-top: 30px; }
.free-hint-inline { color: var(--muted); font-size: 13px; }


/* ---- 页脚版权（全站） ---- */
footer.copyright {
    text-align: center; color: var(--muted); font-size: 12px;
    padding: 18px 0 26px;
}
.free-body footer.copyright {
    position: fixed; bottom: 10px; left: 0; right: 0; padding: 0;
    color: var(--muted); z-index: 30;
}
.free-body .free-hint { bottom: 42px; }
/* 展示/板面：flex 居中 + 溢出可滚（margin:auto 吸收空隙） */
.free-panel, .free-boardwrap { margin: auto; }
