:root {
  --green: #2f6f4f; --green-d: #24573e; --green-l: #e8f1ec; --green-ll: #f4f8f5;
  --red: #c0392b; --red-l: #fbeceb; --amber: #b7791f; --amber-l: #fdf4e3; --blue: #2c5d8a; --blue-l: #e9f0f7;
  --ink: #1f2420; --ink2: #5b635e; --ink3: #8d958f; --line: #e5e9e6; --bg: #f5f6f4; --card: #fff;
  --radius: 14px; --tab-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green); text-decoration: none; }
#app { max-width: 680px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }

/* 顶部栏 */
.topbar { position: sticky; top: 0; z-index: 20; height: 52px; display: flex; align-items: center; gap: 6px;
  padding: 0 8px; background: rgba(245,246,244,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar h1 { flex: 1; font-size: 17px; margin: 0; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .side { width: 72px; display: flex; }
.topbar .side.r { justify-content: flex-end; }
.icon-btn { border: 0; background: none; height: 40px; min-width: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--green); font-size: 15px; cursor: pointer; padding: 0 8px; }
.icon-btn:active { background: var(--green-l); }
.icon-btn svg { width: 22px; height: 22px; }

.page { padding: 12px 14px calc(var(--tab-h) + 24px + var(--safe-b)); }
.page.no-tab { padding-bottom: calc(96px + var(--safe-b)); }

/* 底部导航 */
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 680px; z-index: 30;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; background: #fff; border-top: 1px solid var(--line); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--ink3); font-size: 11px; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.on { color: var(--green); font-weight: 600; }
.tabbar a.main span.dot { width: 46px; height: 46px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; margin-top: -18px; box-shadow: 0 4px 12px rgba(47,111,79,.35); }
.tabbar a.main svg { width: 26px; height: 26px; }

/* 卡片 */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card.tap { cursor: pointer; }
.card.tap:active { background: #fafbfa; }
.card-title { font-weight: 600; font-size: 16px; margin: 0 0 4px; }
.section-title { font-size: 13px; color: var(--ink2); margin: 18px 4px 8px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--ink3); font-size: 13px; }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.chev { color: var(--ink3); }

/* 按钮 */
.btn { border: 0; border-radius: 12px; height: 46px; padding: 0 18px; font-size: 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--green); color: #fff; }
.btn:active { background: var(--green-d); }
.btn.block { width: 100%; }
.btn.sm { height: 34px; font-size: 14px; padding: 0 12px; border-radius: 9px; font-weight: 500; }
.btn.ghost { background: var(--green-l); color: var(--green); }
.btn.line { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--red-l); color: var(--red); }
.btn.blue { background: var(--blue-l); color: var(--blue); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 680px; z-index: 25;
  padding: 10px 14px calc(10px + var(--safe-b)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); display: flex; gap: 10px; }
.btn-bar .btn { flex: 1; }
.fab { position: fixed; right: max(18px, calc(50% - 322px)); bottom: calc(var(--tab-h) + 18px + var(--safe-b)); z-index: 25; height: 50px; border-radius: 25px; padding: 0 20px; box-shadow: 0 6px 16px rgba(47,111,79,.35); }

/* 大入口 */
.hero { background: linear-gradient(135deg, #2f6f4f, #3f8a64); color: #fff; border-radius: 18px; padding: 18px; margin-bottom: 14px; }
.hero h2 { margin: 0 0 2px; font-size: 20px; }
.hero p { margin: 0; opacity: .85; font-size: 13px; }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.quick button { border: 0; border-radius: 14px; background: rgba(255,255,255,.16); color: #fff; padding: 14px 10px; text-align: left; cursor: pointer; }
.quick button b { display: block; font-size: 16px; }
.quick button span { font-size: 12px; opacity: .85; }
.quick button:active { background: rgba(255,255,255,.26); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { background: #fff; border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 20px; color: var(--green); }
.stat span { font-size: 12px; color: var(--ink3); }

/* 标签 */
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; background: #eef0ee; color: var(--ink2); white-space: nowrap; }
.chip.green { background: var(--green-l); color: var(--green); }
.chip.red { background: var(--red-l); color: var(--red); }
.chip.amber { background: var(--amber-l); color: var(--amber); }
.chip.blue { background: var(--blue-l); color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* 分段 / 筛选 */
.seg { display: flex; background: #e9ece9; border-radius: 11px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; height: 34px; border-radius: 9px; font-size: 14px; color: var(--ink2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 8px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters select, .filters input { height: 36px; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 0 8px; font-size: 14px; min-width: 0; }

/* 表单 */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 6px; font-weight: 500; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 0 12px; height: 46px; font-size: 16px; outline: none; }
.textarea { height: auto; min-height: 90px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-l); }
.hint { font-size: 12px; color: var(--ink3); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-cards label { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; background: #fff; font-size: 14px; }
.radio-cards label.on { border-color: var(--green); background: var(--green-ll); }
.radio-cards input { display: none; }

/* 上传 */
.drop { border: 1.5px dashed #c7d1ca; border-radius: 14px; background: #fff; padding: 18px; text-align: center; cursor: pointer; color: var(--ink2); }
.drop:active { background: var(--green-ll); }
.drop b { display: block; color: var(--green); font-size: 16px; margin-bottom: 2px; }
.files { margin-top: 8px; }
.file-row { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 10px; padding: 8px 10px; margin-top: 6px; font-size: 14px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.thumb { position: relative; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden; background: #ddd; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; }
.thumb .n { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 0 6px; border-radius: 8px; }
.add-thumb { aspect-ratio: 3/4; border-radius: 10px; border: 1.5px dashed #c7d1ca; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--green); cursor: pointer; background: #fff; font-size: 13px; }

/* 题目 */
.q { background: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.q-no { font-weight: 700; color: var(--green); min-width: 26px; }
.q-stem { font-size: 15.5px; line-height: 1.8; word-break: break-word; }
.q-options { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; margin-top: 4px; }
.q-fig { max-width: 100%; max-height: 220px; border-radius: 8px; margin-top: 8px; border: 1px solid var(--line); display: block; }
.q-svg { margin-top: 8px; }
.q-svg .geo-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; }
.q-svg .geo-item { text-align: center; }
.q-svg .geo-svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.q-svg .geo-cap { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.ans-box { background: var(--green-ll); border-radius: 10px; padding: 8px 10px; margin-top: 10px; font-size: 14px; }
.ans-box.red { background: var(--red-l); }
.ans-box.amber { background: var(--amber-l); }
.ans-box .lbl { font-size: 12px; color: var(--ink2); font-weight: 600; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.compare > div { border-radius: 10px; padding: 8px 10px; font-size: 14px; border: 1px solid var(--line); }
.compare .lbl { font-size: 12px; color: var(--ink3); }
.mark { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 18px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mark.ok { border-color: var(--green); background: var(--green); color: #fff; }
.mark.warn { border-color: var(--amber); background: var(--amber); color: #fff; }
.mark.no { border-color: var(--red); background: var(--red); color: #fff; }
.review-flag { border-left: 4px solid var(--amber); }
details.more summary { cursor: pointer; color: var(--green); font-size: 13px; margin-top: 8px; }

/* 进度 */
.progress { background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.bar { height: 8px; background: #e7ebe8; border-radius: 4px; overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #2f6f4f, #4aa077); transition: width .5s; border-radius: 4px; }
.spinner { width: 18px; height: 18px; border: 2.5px solid var(--green-l); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 弹层 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.38); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 680px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet-head { display: flex; align-items: center; padding: 12px 14px 8px; }
.sheet-head h3 { flex: 1; margin: 0; font-size: 17px; text-align: center; }
.sheet-body { overflow-y: auto; padding: 6px 14px 14px; }
.sheet-foot { padding: 10px 14px calc(12px + var(--safe-b)); display: flex; gap: 10px; border-top: 1px solid var(--line); background: #fff; }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) { .mask { align-items: center; } .sheet { border-radius: 18px; max-height: 86vh; } }

.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 100; background: rgba(30,35,32,.92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 86vw; text-align: center; }
.toast.err { background: rgba(192,57,43,.95); }
.viewer { position: fixed; inset: 0; background: #000; z-index: 90; display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; }
.empty { text-align: center; color: var(--ink3); padding: 40px 10px; font-size: 14px; }
.empty b { display: block; font-size: 15px; color: var(--ink2); margin-bottom: 4px; }
.notice { background: var(--amber-l); color: #7a5312; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.notice.green { background: var(--green-l); color: var(--green-d); }
.notice.red { background: var(--red-l); color: var(--red); }

/* 登录 */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.login .logo { width: 64px; height: 64px; border-radius: 18px; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; margin-bottom: 16px; }
.login h1 { margin: 0 0 4px; font-size: 24px; }
.login p { margin: 0 0 28px; color: var(--ink3); }

.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps div { flex: 1; height: 4px; border-radius: 2px; background: #dfe4e0; }
.steps div.on { background: var(--green); }
.score { font-size: 34px; font-weight: 700; color: var(--green); line-height: 1.1; }
.perm-group { margin-bottom: 8px; }
.perm-group .g { font-size: 12px; color: var(--ink3); margin: 6px 0 0; }
.katex { font-size: 1.05em; }
.katex-display { margin: .4em 0; overflow-x: auto; overflow-y: hidden; }
