/* =========================================================
   作业批改小助手 · 样式
   移动优先，兼顾 iPhone 安全区 / 深色模式 / 桌面预览
   ========================================================= */

:root {
  --bg: #eef1f7;
  --bg-2: #f7f9fc;
  --card: #ffffff;
  --card-soft: #f5f7fb;
  --text: #101725;
  --text-2: #5b6577;
  --text-3: #8b95a7;
  --line: #e6eaf2;
  --line-strong: #d6dce8;

  --primary: #3b6ef6;
  --primary-dark: #2b57d0;
  --primary-soft: #e8eeff;
  --violet: #7b5cf0;

  --ok: #12a150;
  --ok-soft: #e6f7ee;
  --bad: #e5484d;
  --bad-soft: #fdeceb;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --info: #4b7bec;
  --info-soft: #eaf0ff;
  --gray-soft: #eff1f5;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px rgba(16, 24, 40, .06);
  --shadow-lg: 0 16px 48px rgba(16, 24, 40, .18);

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tab-h: 62px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
    --bg-2: #12151c;
    --card: #171b23;
    --card-soft: #1d222c;
    --text: #eef1f7;
    --text-2: #a4adbf;
    --text-3: #788294;
    --line: #262c38;
    --line-strong: #333b4a;

    --primary: #6f92ff;
    --primary-dark: #8aa6ff;
    --primary-soft: #1e2740;

    --ok: #35c27c;
    --ok-soft: #16301f;
    --bad: #ff6b6f;
    --bad-soft: #35191b;
    --warn: #e8a33d;
    --warn-soft: #33260f;
    --info: #7aa2ff;
    --info-soft: #1a2440;
    --gray-soft: #232833;

    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  overscroll-behavior-y: none;
  background-image:
    radial-gradient(720px 380px at 12% -6%, rgba(59, 110, 246, .13), transparent 62%),
    radial-gradient(640px 360px at 92% 4%, rgba(123, 92, 240, .11), transparent 60%);
  background-repeat: no-repeat;
}

@media (prefers-color-scheme: dark) {
  body {
    background-image:
      radial-gradient(720px 380px at 12% -6%, rgba(59, 110, 246, .17), transparent 62%),
      radial-gradient(640px 360px at 92% 4%, rgba(123, 92, 240, .13), transparent 60%);
  }
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
img { max-width: 100%; display: block; }

/* ---------------- 布局 ---------------- */
.app {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: calc(var(--safe-t) + 4px) 16px calc(var(--tab-h) + var(--safe-b) + 28px);
  display: block;
}

.view { display: none; animation: fadeUp .26s ease both; }
.view.is-active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.topbar.is-scrolled { box-shadow: 0 6px 18px rgba(16, 24, 40, .06); }
@media (prefers-color-scheme: dark) {
  .topbar.is-scrolled { box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
}

.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.logo {
  width: 36px; height: 36px; flex: none;
  border-radius: 11px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--violet));
  box-shadow: 0 6px 16px rgba(59, 110, 246, .32);
}
.logo svg { width: 21px; height: 21px; }

.brand-text { min-width: 0; }
.brand-text h1 { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.brand-text p {
  font-size: 12px; color: var(--text-3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--line);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { transform: scale(.94); }

.nav-back {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
}
.nav-back svg { width: 20px; height: 20px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card.soft { background: var(--card-soft); box-shadow: none; }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.card-head h2 { font-size: 15px; font-weight: 700; }

.pill {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-weight: 600; white-space: nowrap;
}

.muted { color: var(--text-3); font-size: 13px; }
.hint { color: var(--text-3); font-size: 12.5px; line-height: 1.6; }
.hint + .hint { margin-top: 6px; }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 7px;
}

/* ---------------- 分段控件 ---------------- */
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.seg button {
  padding: 9px 6px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  transition: background .18s, color .18s, box-shadow .18s;
}
.seg button.is-active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
}
@media (prefers-color-scheme: dark) {
  .seg button.is-active { background: var(--primary-soft); }
}
.seg button:active { transform: scale(.97); }

/* ---------------- 上传区 ---------------- */
.uploader {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.up-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 15px 6px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--line-strong);
  background: var(--card-soft);
  color: var(--text-2);
  font-size: 13px; font-weight: 600;
  transition: transform .16s, border-color .16s, background .16s;
}
.up-btn:active { transform: scale(.96); border-color: var(--primary); }
.up-emoji { font-size: 20px; line-height: 1; }

.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.thumbs:empty { margin-top: 0; }
.thumb { position: relative; border-radius: 11px; overflow: hidden; aspect-ratio: 1; background: var(--gray-soft); animation: pop .2s ease both; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-del {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0, 0, 0, .58); color: #fff;
  font-size: 12px; line-height: 1; display: grid; place-items: center;
  backdrop-filter: blur(4px);
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.text-wrap { margin-top: 10px; }
textarea.input, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
textarea:focus, .input:focus { border-color: var(--primary); background: var(--card); }

/* ---------------- 输入 ---------------- */
.input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-soft);
  font-size: 16px;
  outline: none;
  transition: border-color .16s, background .16s;
}
select.input { -webkit-appearance: none; appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a7' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
.row-2 { display: flex; gap: 10px; align-items: center; }
.row-2 > .input { flex: 1; min-width: 0; }

/* ---------------- 按钮 ---------------- */
.btn-primary {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px;
  border-radius: 15px;
  font-size: 16.5px; font-weight: 700; letter-spacing: .5px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #5a63f0 55%, var(--violet));
  box-shadow: 0 10px 24px rgba(59, 110, 246, .34);
  transition: transform .15s, box-shadow .15s, opacity .2s;
}
.btn-primary:active { transform: scale(.98); box-shadow: 0 4px 12px rgba(59, 110, 246, .3); }
.btn-primary[disabled] { opacity: .55; pointer-events: none; }
.btn-primary.sm { width: auto; padding: 11px 18px; font-size: 14.5px; border-radius: 12px; }
.btn-ico { font-size: 16px; }

.btn-soft {
  flex: 1;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
}
.btn-soft:active { transform: scale(.97); }

.btn-ghost {
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 14px; font-weight: 600;
  white-space: nowrap;
}
.btn-ghost.sm { padding: 8px 13px; font-size: 13px; border-radius: 10px; }
.btn-ghost:active { transform: scale(.96); }

/* 声音预设 */
.vchips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.vchips button {
  padding: 11px 6px;
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  background: var(--card-soft);
  border: 1.5px solid transparent;
  color: var(--text-2);
  transition: all .16s;
}
.vchips button.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}
.vchips button:active { transform: scale(.95); }

/* 滑杆 */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  margin: 0;
}
.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--gray-soft);
  border: 1px solid var(--line);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 2px 6px rgba(16, 24, 40, .18);
}
.field-label b { color: var(--primary); font-variant-numeric: tabular-nums; }

.tips {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin: 12px 0 4px;
  padding: 0 10px;
}

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px calc(6px + var(--safe-b));
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
body.is-result .tabbar { display: none; }
body.is-result main { padding-bottom: calc(var(--safe-b) + 24px); }

.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0 4px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
  transition: color .16s;
}
.tab svg { width: 23px; height: 23px; }
.tab.is-active { color: var(--primary); }
.tab:active { transform: scale(.94); }

.tab-badge {
  position: absolute;
  top: 2px; left: 50%; margin-left: 6px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px;
  background: var(--bad); color: #fff;
  font-size: 10px; font-style: normal; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--card);
}

/* ---------------- 结果页 ---------------- */
.result-hero {
  display: flex; align-items: center; gap: 16px;
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--card), var(--card));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.ring {
  --p: 0;
  --c: var(--ok);
  width: 76px; height: 76px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--gray-soft) 0);
  position: relative;
}
.ring::after {
  content: "";
  position: absolute; inset: 7px;
  border-radius: 50%;
  background: var(--card);
}
.ring span {
  position: relative; z-index: 1;
  font-size: 20px; font-weight: 800; letter-spacing: -.5px;
  color: var(--c);
}
.ring span small { font-size: 11px; font-weight: 600; }
.hero-text { min-width: 0; flex: 1; }
.hero-text h2 { font-size: 18px; font-weight: 800; letter-spacing: -.2px; }
.hero-text h2 b { color: var(--ok); }
.hero-brand { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.hero-counts { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.chip-count {
  font-size: 11.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
}
.chip-count.ok { background: var(--ok-soft); color: var(--ok); }
.chip-count.bad { background: var(--bad-soft); color: var(--bad); }
.chip-count.warn { background: var(--warn-soft); color: var(--warn); }
.chip-count.info { background: var(--info-soft); color: var(--info); }

.summary-card { padding: 14px 16px; }
.summary-card p { font-size: 14.5px; line-height: 1.7; }
.summary-card .encourage { margin-top: 8px; font-size: 13.5px; color: var(--text-2); }

.filter-row {
  display: flex; gap: 7px; overflow-x: auto;
  margin: 2px 0 12px;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-row button {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.filter-row button.is-active {
  background: var(--text); color: var(--bg); border-color: var(--text);
}

.stack > * + * { margin-top: 10px; }

/* 题目卡片 */
.qcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.qcard[data-status="correct"] { border-left-color: var(--ok); }
.qcard[data-status="wrong"] { border-left-color: var(--bad); }
.qcard[data-status="partial"] { border-left-color: var(--warn); }
.qcard[data-status="blank"] { border-left-color: var(--text-3); }
.qcard[data-status="subjective"] { border-left-color: var(--info); }

.qhead { display: flex; align-items: center; gap: 8px; }
.qno {
  width: 24px; height: 24px; flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: var(--card-soft); color: var(--text-2);
}
.qtype { font-size: 12px; color: var(--text-3); }
.badge {
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.gray { background: var(--gray-soft); color: var(--text-3); }
.qhead .badge { margin-left: auto; }
.qchev {
  width: 18px; height: 18px; flex: none;
  color: var(--text-3);
  transition: transform .22s;
}
.qcard.is-open .qchev { transform: rotate(90deg); }

.qstem {
  font-size: 15px; line-height: 1.65;
  margin-top: 8px;
  word-break: break-word;
  white-space: pre-wrap;
}
.qcard:not(.is-open) .qstem {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.qbody { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.qcard.is-open .qbody { display: block; animation: fadeUp .24s ease; }

.ans-row {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 14px; margin-bottom: 7px;
}
.ans-row .k { color: var(--text-3); font-size: 12.5px; flex: none; width: 58px; }
.ans-row .v { font-weight: 700; word-break: break-word; white-space: pre-wrap; }
.ans-row .v.ok { color: var(--ok); }
.ans-row .v.bad { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.ans-row .v.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

.comment {
  font-size: 14px; line-height: 1.7;
  background: var(--card-soft);
  border-radius: 11px;
  padding: 10px 12px;
  margin: 10px 0;
  word-break: break-word;
}

.block-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: var(--text-2);
  margin: 14px 0 8px;
}

.steps { counter-reset: s; }
.steps li {
  position: relative;
  padding-left: 26px;
  font-size: 14px; line-height: 1.65;
  margin-bottom: 7px;
  word-break: break-word;
  animation: rise .34s ease;
}
.steps li::before {
  counter-increment: s;
  content: counter(s);
  position: absolute; left: 0; top: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 8px;
  background: var(--primary-soft); color: var(--primary);
}

.tipbox {
  display: flex; gap: 7px;
  font-size: 13px; line-height: 1.6;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 10px;
  padding: 9px 11px;
  margin-top: 10px;
}

.qactions {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 12px;
}
.qactions button {
  flex: 1 1 auto;
  min-width: 92px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  background: var(--card-soft);
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}
.qactions button:active { transform: scale(.96); }
.qactions button.accent { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.qactions button.done { color: var(--ok); background: var(--ok-soft); border-color: transparent; }

.result-foot { margin-top: 18px; }
.next-list { margin-top: 6px; }
.next-list li {
  font-size: 14px; line-height: 1.7;
  padding-left: 20px; position: relative;
}
.next-list li::before {
  content: "→"; position: absolute; left: 0; color: var(--primary); font-weight: 700;
}

/* ---------------- 列表页 ---------------- */
.view-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 8px 2px 12px;
}
.view-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.head-actions { display: flex; gap: 8px; }

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}
.empty .em { font-size: 40px; margin-bottom: 10px; opacity: .8; }
.empty p { font-size: 14px; }
.empty .btn-ghost { margin: 16px auto 0; display: inline-block; }

.wrong-item, .history-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
}
.item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.item-top .badge { margin-left: auto; }
.item-sub { font-size: 11.5px; color: var(--text-3); }
.stem-clamp {
  font-size: 14.5px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.item-ans { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.item-ans b { color: var(--ok); }
.item-foot { display: flex; gap: 8px; margin-top: 10px; }
.item-foot button {
  padding: 7px 12px; border-radius: 9px; font-size: 12.5px; font-weight: 600;
  background: var(--card-soft); border: 1px solid var(--line); color: var(--text-2);
}
.item-foot button.danger { color: var(--bad); }

.history-item .rate-bar {
  height: 6px; border-radius: 999px; background: var(--gray-soft);
  overflow: hidden; margin-top: 9px;
}
.history-item .rate-bar i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--ok), var(--primary));
}
.history-top { display: flex; align-items: center; gap: 8px; }
.history-top .t { font-size: 12px; color: var(--text-3); margin-left: auto; }

/* ---------------- 遮罩 / 进度 ---------------- */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(10, 14, 22, .42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.progress-card {
  width: 100%; max-width: 320px;
  background: var(--card);
  border-radius: 22px;
  padding: 26px 22px 20px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: pop .26s ease both;
}
.progress-card h3 { font-size: 16.5px; font-weight: 700; margin-top: 16px; }
.progress-step { font-size: 13.5px; color: var(--text-2); margin-top: 6px; min-height: 22px; }
.progress-time { font-size: 12px; color: var(--text-3); margin: 4px 0 14px; font-variant-numeric: tabular-nums; }

.spinner {
  width: 46px; height: 46px; margin: 0 auto;
  border-radius: 50%;
  border: 4px solid var(--primary-soft);
  border-top-color: var(--primary);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 弹层 ---------------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(10, 14, 22, .45);
  display: flex; align-items: flex-end;
  animation: fade .18s ease both;
}
.sheet {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(20px + var(--safe-b));
  box-shadow: var(--shadow-lg);
  animation: sheetUp .26s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

.sheet h3 { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.sheet .sheet-sub { font-size: 13px; color: var(--text-3); margin-bottom: 16px; }
.sheet .kw {
  background: var(--card-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px;
  font-size: 14px; font-weight: 600; word-break: break-all;
  display: flex; align-items: center; gap: 8px;
}
.sheet .kw span { flex: 1; }
.sheet .kw button { font-size: 12px; font-weight: 700; color: var(--primary); flex: none; }

.sheet-links { display: grid; gap: 9px; margin-top: 14px; }
.sheet-links a {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px;
  border-radius: 13px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 600;
}
.sheet-links a .sub { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 500; }
.sheet-links a:active { transform: scale(.985); }

.sheet-close {
  width: 100%; margin-top: 14px;
  padding: 13px;
  border-radius: 13px;
  background: var(--card-soft);
  border: 1px solid var(--line);
  font-size: 15px; font-weight: 600; color: var(--text-2);
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 20px);
  transform: translateX(-50%) translateY(10px);
  z-index: 120;
  max-width: 86%;
  padding: 11px 18px;
  border-radius: 13px;
  background: rgba(20, 24, 33, .92);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: rgba(190, 40, 45, .95); }
.toast.ok { background: rgba(14, 130, 74, .95); }

/* ---------------- 二维码 ---------------- */
.qr-box { display: flex; gap: 14px; align-items: center; margin-top: 12px; }
.qr-box img {
  width: 108px; height: 108px; flex: none;
  border-radius: 10px; background: #fff; padding: 5px;
  border: 1px solid var(--line);
}
.qr-box code {
  display: block;
  font-size: 13px; font-weight: 600;
  word-break: break-all;
  color: var(--primary);
}

.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-3); display: inline-block;
}
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }

/* ---------------- 桌面端 ---------------- */
@media (min-width: 700px) {
  .app { box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(16, 24, 40, .1); min-height: 100vh; }
  .tabbar { border-radius: 0; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; transition-duration: .001s !important; }
}
