/* ===========================================================
   考公错题本 · 不贰过
   设计语言：纸墨 · 朱批 · 克制
   =========================================================== */

:root {
  --paper:        #f6f3ec;
  --paper-2:      #efeade;
  --surface:      #fffdf8;
  --surface-2:    #faf7ef;
  --ink:          #1d1b18;
  --ink-2:        #4d4740;
  --ink-3:        #857d71;
  --ink-4:        #b3ab9d;
  --line:         #e3ddcf;
  --line-2:       #d3cab8;

  --red:          #b83a2a;
  --red-soft:     #f6e6e2;
  --red-deep:     #8e2a1d;
  --green:        #346b52;
  --green-soft:   #e4efe8;
  --amber:        #b0761c;
  --amber-soft:   #f8edd8;
  --blue:         #35608a;
  --blue-soft:    #e4edf5;

  --radius:       14px;
  --radius-sm:    9px;
  --shadow-sm:    0 1px 2px rgba(40, 33, 22, .05);
  --shadow:       0 2px 10px rgba(40, 33, 22, .07), 0 1px 2px rgba(40, 33, 22, .05);
  --shadow-lg:    0 18px 44px rgba(40, 33, 22, .14), 0 2px 8px rgba(40, 33, 22, .07);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "SimSun", "Source Han Serif SC", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --nav-h: 62px;
  --maxw: 1180px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-image:
    radial-gradient(circle at 12% 8%, rgba(184, 58, 42, .035), transparent 32%),
    radial-gradient(circle at 88% 92%, rgba(52, 107, 82, .035), transparent 34%);
  background-attachment: fixed;
}

::selection { background: #f3d7cf; color: var(--ink); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 99px; border: 3px solid var(--paper);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ===========================================================
   布局
   =========================================================== */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.boot {
  padding: 120px 24px; text-align: center;
  color: var(--ink-3); font-family: var(--serif); font-size: 17px;
  letter-spacing: .1em;
}

.topbar {
  position: sticky; top: 0; z-index: 60;
  background: rgba(246, 243, 236, .86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 22px; height: var(--nav-h);
  display: flex; align-items: center; gap: 22px;
}

.brand { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; }
.brand-mark {
  font-family: var(--serif); font-size: 21px; font-weight: 700;
  letter-spacing: .14em; color: var(--ink);
}
.brand-mark .seal {
  display: inline-block; margin-left: 6px; padding: 1px 5px 2px;
  font-size: 11px; letter-spacing: .12em; font-family: var(--sans);
  color: #fff; background: var(--red); border-radius: 3px;
  vertical-align: 3px; font-weight: 600;
}
.brand-sub {
  font-size: 12px; color: var(--ink-3); letter-spacing: .18em;
}

.nav { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.nav button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 14px; color: var(--ink-2);
  padding: 8px 13px; border-radius: 8px;
  transition: background .15s, color .15s;
  position: relative; white-space: nowrap;
}
.nav button:hover { background: var(--paper-2); color: var(--ink); }
.nav button.on { color: var(--red-deep); font-weight: 600; background: var(--red-soft); }
.nav button .dot {
  position: absolute; top: 3px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 2px var(--surface);
}

.main {
  flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 30px 22px 90px;
}

/* ===========================================================
   通用元件
   =========================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }

.sec-title {
  font-family: var(--serif); font-size: 17px; font-weight: 700;
  letter-spacing: .06em; margin: 0 0 14px;
  display: flex; align-items: center; gap: 9px;
}
.sec-title::before {
  content: ""; width: 3px; height: 15px; border-radius: 2px;
  background: var(--red); flex-shrink: 0;
}
.sec-title .more {
  margin-left: auto; font-family: var(--sans); font-size: 12.5px;
  font-weight: 400; color: var(--ink-3); cursor: pointer; letter-spacing: 0;
}
.sec-title .more:hover { color: var(--red); }

.page-head { margin-bottom: 24px; }
.page-title {
  font-family: var(--serif); font-size: 27px; font-weight: 700;
  letter-spacing: .05em; margin: 0 0 6px;
}
.page-desc { color: var(--ink-3); font-size: 13.5px; margin: 0; }

.btn {
  appearance: none; cursor: pointer; font-family: inherit; font-size: 14px;
  padding: 9px 17px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  transition: all .15s; font-weight: 500; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--ink-4); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ink); border-color: var(--ink); color: #fff;
}
.btn-primary:hover { background: #33302b; border-color: #33302b; }
.btn-red { background: var(--red); border-color: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { background: #275540; border-color: #275540; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* 筛选条 */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 18px;
}
.chip {
  appearance: none; cursor: pointer; font-family: inherit;
  font-size: 13px; padding: 6px 13px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  transition: all .15s; white-space: nowrap;
}
.chip:hover { border-color: var(--ink-4); color: var(--ink); }
.chip.on {
  background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 500;
}
.chip.on.red { background: var(--red); border-color: var(--red); }
.chip .cnt {
  font-size: 11.5px; opacity: .62; margin-left: 4px;
  font-variant-numeric: tabular-nums;
}

.search-wrap { position: relative; flex: 1; min-width: 170px; }
.search-wrap input {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--ink);
  padding: 9px 14px 9px 36px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap input:focus {
  outline: 0; border-color: var(--ink-4);
  box-shadow: 0 0 0 3px rgba(184, 58, 42, .09);
}
.search-wrap .ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--ink-4); font-size: 13px; pointer-events: none;
}

select.plain {
  font-family: inherit; font-size: 13px; color: var(--ink);
  padding: 7px 30px 7px 12px; border-radius: 99px;
  border: 1px solid var(--line-2); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23857d71'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none; cursor: pointer;
}
select.plain:focus { outline: 0; border-color: var(--ink-4); }

/* 标签 */
.tag {
  display: inline-block; font-size: 11.5px; line-height: 1.6;
  padding: 1.5px 8px; border-radius: 5px;
  background: var(--paper-2); color: var(--ink-2);
  border: 1px solid transparent; white-space: nowrap;
}
.tag.red    { background: var(--red-soft);   color: var(--red-deep); }
.tag.green  { background: var(--green-soft); color: var(--green); }
.tag.amber  { background: var(--amber-soft); color: var(--amber); }
.tag.blue   { background: var(--blue-soft);  color: var(--blue); }
.tag.line   { background: transparent; border-color: var(--line-2); }

/* 空态 */
.empty {
  text-align: center; padding: 60px 20px; color: var(--ink-3);
}
.empty .big {
  font-family: var(--serif); font-size: 44px; opacity: .28;
  margin-bottom: 10px; letter-spacing: .1em;
}
.empty p { margin: 4px 0; font-size: 14px; }

/* ===========================================================
   总览
   =========================================================== */
.hero {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px;
  margin-bottom: 22px;
}

.greet {
  padding: 26px 28px; position: relative; overflow: hidden;
  background: linear-gradient(150deg, #fffdf8 0%, #fbf6ea 58%, #f7efe0 100%);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.greet::after {
  content: "不贰过";
  position: absolute; right: -8px; bottom: -26px;
  font-family: var(--serif); font-size: 92px; font-weight: 700;
  color: rgba(184, 58, 42, .055); letter-spacing: .06em;
  pointer-events: none; user-select: none;
}
.greet h1 {
  font-family: var(--serif); font-size: 25px; font-weight: 700;
  margin: 0 0 8px; letter-spacing: .05em;
}
.greet .motto {
  color: var(--ink-2); font-size: 13.5px; margin: 0 0 20px;
  font-family: var(--serif); letter-spacing: .08em;
}
.greet .motto cite { font-style: normal; color: var(--ink-3); font-size: 12px; }

.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }

.ring-wrap { display: flex; align-items: center; gap: 20px; }
.ring { position: relative; width: 108px; height: 108px; flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .lbl {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring .lbl b {
  font-family: var(--serif); font-size: 26px; font-weight: 700;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.ring .lbl span { font-size: 11px; color: var(--ink-3); margin-top: 4px; letter-spacing: .1em; }

.kv-list { display: flex; flex-direction: column; gap: 11px; flex: 1; }
.kv {
  display: flex; align-items: baseline; gap: 8px; font-size: 13.5px;
}
.kv .k { color: var(--ink-3); }
.kv .v {
  margin-left: auto; font-family: var(--serif); font-size: 17px;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.kv .v small { font-size: 11px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 22px;
}
.stat {
  padding: 17px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform .16s, box-shadow .16s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .n {
  font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.stat .n small { font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 3px; }
.stat .k { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; letter-spacing: .04em; }
.stat.red .n { color: var(--red); }
.stat.green .n { color: var(--green); }
.stat.amber .n { color: var(--amber); }
.stat.blue .n { color: var(--blue); }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* 进度条 */
.bar-row { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.bar-row .nm {
  font-size: 13px; color: var(--ink-2); width: 118px; flex-shrink: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bar-row .track {
  flex: 1; height: 7px; border-radius: 99px; background: var(--paper-2);
  overflow: hidden;
}
.bar-row .fill {
  height: 100%; border-radius: 99px; background: var(--green);
  transition: width .5s cubic-bezier(.22,.8,.3,1);
}
.bar-row .fill.red { background: var(--red); }
.bar-row .fill.amber { background: var(--amber); }
.bar-row .fill.blue { background: var(--blue); }
.bar-row .num {
  font-size: 12px; color: var(--ink-3); width: 54px; text-align: right;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}

/* 迷你热力 */
.heat { display: flex; gap: 3px; align-items: flex-end; height: 52px; }
.heat i {
  flex: 1; border-radius: 3px 3px 2px 2px; min-height: 5px;
  background: #ebe4d8; display: block;
  transition: background .3s;
}
.heat i[data-l="0"] { background: #ebe5d9; }
.heat i[data-l="1"] { background: #e8bfb4; }
.heat i[data-l="2"] { background: #d18773; }
.heat i[data-l="3"] { background: var(--red); }
.heat-lbl {
  display: flex; justify-content: space-between;
  font-size: 10.5px; color: var(--ink-4); margin-top: 8px;
}

/* ===========================================================
   错题条目
   =========================================================== */
.item-list { display: flex; flex-direction: column; gap: 12px; }

.item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 17px 19px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
  position: relative; overflow: hidden; cursor: pointer;
}
.item:hover {
  border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px);
}
.item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--ink-4);
}
.item[data-hot="1"]::before { background: var(--red); }
.item[data-status="mastered"]::before { background: var(--green); }
.item[data-status="new"]::before { background: var(--amber); }

.item-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.item-idx {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-4);
  letter-spacing: .04em;
}
.item-sub {
  font-size: 13px; color: var(--ink); font-weight: 600;
  padding: 1px 8px; border-radius: 5px; background: var(--paper-2);
}
.item-mod { font-size: 12.5px; color: var(--ink-3); }
.item-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.item-q {
  font-size: 14.5px; line-height: 1.72; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 9px;
}
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-3); }
.item-meta .sep { color: var(--ink-4); }

.lapses {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; color: var(--red-deep); font-weight: 600;
}

/* 详情弹层 */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(30, 25, 18, .42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 18px; overflow-y: auto;
  animation: fadein .18s ease;
}
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }

.modal {
  background: var(--surface); border-radius: 18px; width: 100%;
  max-width: 720px; box-shadow: var(--shadow-lg);
  animation: rise .22s cubic-bezier(.22,.8,.3,1);
  border: 1px solid var(--line);
  margin: auto 0;
}
.modal-head {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
  position: sticky; top: 0; background: var(--surface);
  border-radius: 18px 18px 0 0; z-index: 2;
}
.modal-head h2 {
  font-family: var(--serif); font-size: 18px; font-weight: 700;
  margin: 0; letter-spacing: .04em; flex: 1;
}
.modal-close {
  appearance: none; border: 0; background: var(--paper-2); cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px; color: var(--ink-2);
  font-size: 17px; line-height: 1; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-close:hover { background: var(--line); }
.modal-body { padding: 22px 24px; }

/* 题目区块 */
.q-block {
  font-size: 15.5px; line-height: 1.85; color: var(--ink);
  padding: 16px 18px; background: var(--surface-2);
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  white-space: pre-wrap; word-break: break-word;
}
.opts { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.opts li {
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14px; line-height: 1.6;
  display: flex; gap: 9px; align-items: flex-start;
}
.opts li .ol {
  font-weight: 700; color: var(--ink-3); flex-shrink: 0;
  font-family: var(--serif); min-width: 15px;
}
.opts li.correct {
  border-color: #a8c6b5; background: var(--green-soft);
}
.opts li.correct .ol { color: var(--green); }
.opts li.wrong {
  border-color: #e0b3aa; background: var(--red-soft);
}
.opts li.wrong .ol { color: var(--red); }

.field { margin-top: 20px; }
.field-h {
  font-size: 12px; color: var(--ink-3); letter-spacing: .14em;
  text-transform: uppercase; margin-bottom: 7px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.field-h .bar2 { width: 14px; height: 2px; background: var(--ink-4); border-radius: 1px; }
.field-body {
  font-size: 14.5px; line-height: 1.82; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word;
}
.field-body.mono { font-family: var(--mono); font-size: 13.5px; }

.callout {
  padding: 13px 16px; border-radius: var(--radius-sm);
  border-left: 3px solid var(--amber); background: var(--amber-soft);
  font-size: 14px; line-height: 1.78; color: #6d4a10;
  white-space: pre-wrap;
}
.callout.red { border-color: var(--red); background: var(--red-soft); color: var(--red-deep); }
.callout.green { border-color: var(--green); background: var(--green-soft); color: #1f4a35; }

.answer-row { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.answer-pill {
  flex: 1; min-width: 120px; padding: 11px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2);
}
.answer-pill .k { font-size: 11.5px; color: var(--ink-3); letter-spacing: .1em; }
.answer-pill .v {
  font-family: var(--serif); font-size: 19px; font-weight: 700; margin-top: 3px;
}
.answer-pill.ok { border-color: #a8c6b5; background: var(--green-soft); }
.answer-pill.ok .v { color: var(--green); }
.answer-pill.bad { border-color: #e0b3aa; background: var(--red-soft); }
.answer-pill.bad .v { color: var(--red); }

/* ===========================================================
   复习模式
   =========================================================== */
.review-shell { max-width: 760px; margin: 0 auto; }

.review-progress {
  display: flex; align-items: center; gap: 13px; margin-bottom: 22px;
}
.review-progress .track {
  flex: 1; height: 5px; border-radius: 99px; background: var(--paper-2); overflow: hidden;
}
.review-progress .fill {
  height: 100%; background: var(--red); border-radius: 99px;
  transition: width .4s cubic-bezier(.22,.8,.3,1);
}
.review-progress .txt {
  font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rcard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow);
  padding: 30px 32px;
}
.rcard .rq {
  font-size: 16px; line-height: 1.9; white-space: pre-wrap;
  margin-bottom: 18px; word-break: break-word;
}
.rcard .rq .blank {
  display: inline-block; width: 52px; border-bottom: 1.5px solid var(--red);
  margin: 0 3px; vertical-align: -.1em;
}

.reveal-btn {
  width: 100%; padding: 15px; margin-top: 22px;
  border: 1px dashed var(--line-2); background: var(--surface-2);
  border-radius: var(--radius-sm); cursor: pointer; font-family: inherit;
  font-size: 14.5px; color: var(--ink-2); transition: all .16s;
  letter-spacing: .08em;
}
.reveal-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 20px; }
.grade {
  padding: 14px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--surface); cursor: pointer; font-family: inherit;
  text-align: center; transition: all .15s; font-size: 14px; color: var(--ink);
}
.grade b { display: block; font-size: 14.5px; margin-bottom: 3px; }
.grade small { font-size: 11px; color: var(--ink-3); }
.grade:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.grade.g1:hover { border-color: var(--red); background: var(--red-soft); }
.grade.g2:hover { border-color: var(--amber); background: var(--amber-soft); }
.grade.g3:hover { border-color: var(--green); background: var(--green-soft); }
.grade.g4:hover { border-color: var(--blue); background: var(--blue-soft); }

/* ===========================================================
   知识点
   =========================================================== */
.k-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.kcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: all .16s; position: relative;
}
.kcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.kcard h3 {
  font-family: var(--serif); font-size: 16px; font-weight: 700; margin: 0 0 8px;
  letter-spacing: .03em;
}
.kcard .crumb { font-size: 11.5px; color: var(--ink-3); margin-bottom: 7px; }
.kcard p {
  font-size: 13.5px; color: var(--ink-2); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.7;
}
.kcard .foot {
  margin-top: 11px; display: flex; gap: 6px; flex-wrap: wrap;
  padding-top: 11px; border-top: 1px dashed var(--line);
}

.formula {
  font-family: var(--mono); font-size: 13.5px;
  background: #fff; border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  padding: 10px 14px; border-radius: 7px; margin: 8px 0;
  overflow-x: auto; white-space: pre-wrap; color: #22402f;
  line-height: 1.7;
}

.trap-list { counter-reset: trap; list-style: none; padding: 0; margin: 0; }
.trap-list li {
  counter-increment: trap; position: relative; padding-left: 30px;
  margin-bottom: 11px; font-size: 14px; line-height: 1.78; color: var(--ink-2);
}
.trap-list li::before {
  content: counter(trap); position: absolute; left: 0; top: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--red-soft); color: var(--red-deep);
  font-size: 11px; font-weight: 700; font-family: var(--sans);
  display: flex; align-items: center; justify-content: center;
}

/* ===========================================================
   统计
   =========================================================== */
.ana-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.rank-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.rank-row:last-child { border-bottom: 0; }
.rank-no {
  font-family: var(--serif); font-size: 15px; font-weight: 700;
  color: var(--ink-4); width: 20px; flex-shrink: 0;
}
.rank-row:nth-child(1) .rank-no { color: var(--red); }
.rank-row:nth-child(2) .rank-no { color: var(--amber); }
.rank-name { font-size: 13.5px; color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}

/* ===========================================================
   录入表单
   =========================================================== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row.full { grid-column: 1 / -1; }
.form-row label {
  font-size: 12.5px; color: var(--ink-3); font-weight: 600; letter-spacing: .05em;
}
.form-row label .req { color: var(--red); margin-left: 2px; }
.form-row input, .form-row textarea, .form-row select {
  font-family: inherit; font-size: 14px; color: var(--ink);
  padding: 10px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface);
  transition: border-color .15s, box-shadow .15s; width: 100%;
}
.form-row textarea { resize: vertical; min-height: 84px; line-height: 1.7; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: 0; border-color: var(--ink-4);
  box-shadow: 0 0 0 3px rgba(184, 58, 42, .09);
}
.form-hint { font-size: 11.5px; color: var(--ink-4); line-height: 1.5; }

/* ===========================================================
   轻提示
   =========================================================== */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 22px;
  border-radius: 99px; font-size: 13.5px; z-index: 500;
  box-shadow: var(--shadow-lg); animation: rise .2s ease;
  max-width: 88vw; text-align: center;
}
.toast.good { background: var(--green); }
.toast.bad { background: var(--red); }

/* ===========================================================
   响应式
   =========================================================== */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .dash-cols { grid-template-columns: 1fr; }
  .ana-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  :root { --nav-h: 52px; }
  .main { padding: 16px 13px 96px; }

  /* 关键：backdrop-filter 会给 fixed 子孙创建包含块，移动端必须关掉 */
  .topbar {
    backdrop-filter: none; -webkit-backdrop-filter: none;
    background: var(--paper);
  }
  .topbar-inner { padding: 0 14px; gap: 12px; height: var(--nav-h); }
  .brand-sub { display: none; }
  .brand-mark { font-size: 18px; letter-spacing: .1em; }
  .brand-mark .seal { font-size: 10px; padding: 1px 4px; }

  /* 移动端：导航变底部标签栏 */
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    margin: 0; padding: 5px 3px calc(5px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 253, 248, .97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -1px 12px rgba(40, 33, 22, .06);
    display: grid; grid-template-columns: repeat(6, 1fr);
    gap: 0; overflow: visible; flex-wrap: nowrap;
  }
  .nav button {
    padding: 8px 2px; font-size: 11.5px; border-radius: 8px;
    line-height: 1.25; text-align: center; color: var(--ink-3);
    background: transparent;
  }
  .nav button:hover { background: transparent; color: var(--ink-2); }
  .nav button.on { background: transparent; color: var(--red-deep); font-weight: 700; }
  .nav button.on::after {
    content: ""; position: absolute; left: 50%; bottom: -1px;
    transform: translateX(-50%);
    width: 16px; height: 2.5px; border-radius: 2px 2px 0 0; background: var(--red);
  }
  .nav button .dot { top: 4px; right: calc(50% - 15px); }

  .page-title { font-size: 22px; }
  .greet { padding: 20px 18px; }
  .greet h1 { font-size: 19px; line-height: 1.45; }
  .greet::after { font-size: 58px; bottom: -12px; right: -4px; }
  .hero-actions .btn { flex: 1; justify-content: center; }
  .stat { padding: 14px 14px; }
  .stat .n { font-size: 24px; }
  .card-pad { padding: 15px 14px; }
  .modal-mask { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; max-width: none; margin: 0; }
  .modal-head { border-radius: 0; padding: 16px 16px 13px; }
  .modal-body { padding: 16px 15px 40px; }
  .rcard { padding: 20px 16px; }
  .rcard .rq { font-size: 15px; }
  .grade-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .item { padding: 14px 14px; }
  .item-q { font-size: 14px; }
  .bar-row .nm { width: 84px; font-size: 12.5px; }
  .k-grid { grid-template-columns: 1fr; }
  .toast { bottom: 84px; }
}

@media print {
  .topbar, .nav, .hero-actions, .reveal-btn, .grade-row, .btn { display: none !important; }
  body { background: #fff; }
  .item, .card, .kcard { box-shadow: none; border-color: #ccc; break-inside: avoid; }
}
