/* ============================ 学习统计 ============================ */
.stats-bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; padding-bottom: 40px; }
.stat-card {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  padding: clamp(18px, 2.6vw, 28px);
  min-height: 140px;
  display: flex; flex-direction: column;
}
.stat-card__label { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--on-bg-var); }
.stat-card__label svg { width: 15px; height: 15px; }
.stat-card__big { font-family: var(--font-display); font-size: clamp(40px, 5vw, 58px); line-height: 1; letter-spacing: -.04em; margin-top: auto; padding-top: 20px; }
.stat-card__big small { font-size: 14px; font-family: var(--font-sans); letter-spacing: 0; color: var(--on-bg-var); margin-left: 5px; }
.stat-card__sub { font-size: 11.5px; color: var(--on-bg-var); margin-top: 7px; }
.stat-card--total { grid-column: span 4; background: var(--ink); color: var(--on-ink); border-color: var(--ink-line); }
.stat-card--total .stat-card__label, .stat-card--total .stat-card__sub { color: color-mix(in oklab, var(--on-ink) 60%, transparent); }
.stat-card--total .stat-card__big { color: var(--on-ink); }
.stat-card--total::after {
  content: ""; position: absolute; right: -50px; top: -50px; width: 190px; height: 190px;
  border-radius: 50%; border: 1px solid color-mix(in oklab, var(--on-ink) 16%, transparent);
}
.stat-card--streak { grid-column: span 3; }
.stat-card--streak .flame { position: absolute; right: 20px; top: 20px; width: 32px; height: 32px; color: var(--ter); }
.stat-card--week { grid-column: span 5; }
.stat-card--accuracy { grid-column: span 3; }
.stat-card--today { grid-column: span 3; }
.stat-card--time { grid-column: span 6; }

.mini-bars { display: flex; align-items: flex-end; gap: 7px; height: 84px; margin-top: auto; }
.mini-bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.mini-bars .b i { display: block; width: 100%; max-width: 30px; border-radius: 5px 5px 2px 2px; background: var(--p); opacity: .82; }
.mini-bars .b.is-today i { opacity: 1; box-shadow: 0 0 0 2px color-mix(in oklab, var(--p) 22%, transparent); }
.mini-bars .b span { font-size: 9px; color: var(--on-bg-var); }
.mini-bars .b em { font-style: normal; font-family: var(--font-mono); font-size: 9.5px; color: var(--on-bg-var); height: 12px; }
.week-empty { margin-top: auto; font-size: 12px; color: var(--on-bg-var); display: flex; align-items: center; gap: 8px; }
.week-empty svg { width: 16px; height: 16px; }

.mastery-card { grid-column: span 7; }
.weak-card { grid-column: span 5; }
.recent-card { grid-column: span 12; }
.stat-card h3 { font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.stat-card > h3 { margin-bottom: 4px; }
.wafer { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 18px; }
.wafer-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--bg-2); transition: background .2s var(--ease); }
.wafer-item:hover { background: var(--bg-3); }
.wafer-ring { width: 42px; height: 42px; flex: none; position: relative; }
.wafer-ring svg { transform: rotate(-90deg); }
.wafer-ring .bg { fill: none; stroke: color-mix(in oklab, var(--cc) 18%, transparent); stroke-width: 5; }
.wafer-ring .fg { fill: none; stroke: var(--cc); stroke-width: 5; stroke-linecap: round; }
.wafer-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 9px; color: var(--on-bg-var); font-weight: 500; }
.wafer-item__name { min-width: 0; }
.wafer-item__name b { display: block; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wafer-item__name span { font-size: 9.5px; color: var(--on-bg-var); }

.weak-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.weak-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px; background: var(--bg-2); font-size: 11.5px; }
.weak-item b { flex: 1; min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weak-item span { font-family: var(--font-mono); font-size: 10px; color: var(--danger); }
.weak-item .bar { width: 54px; height: 3px; border-radius: 99px; background: var(--bg-4); overflow: hidden; flex: none; }
.weak-item .bar i { display: block; height: 100%; background: var(--danger); }
.weak-empty { margin-top: 18px; font-size: 12px; color: var(--on-bg-var); display: flex; gap: 8px; align-items: center; }

.recent-list { display: flex; flex-direction: column; margin-top: 8px; }
.recent-row { display: grid; grid-template-columns: 100px 1fr auto auto; gap: 14px; padding: 12px 4px; align-items: center; border-bottom: 1px solid var(--line-soft); font-size: 12px; }
.recent-row:last-child { border-bottom: 0; }
.recent-row__time { font-family: var(--font-mono); font-size: 10px; color: var(--on-bg-var); }
.recent-row__name { font-weight: 550; }
.recent-row__score { font-family: var(--font-mono); font-size: 11.5px; color: var(--on-bg-var); }
.recent-row__bar { width: 80px; height: 3px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.recent-row__bar i { display: block; height: 100%; background: var(--p); }

.stats-foot { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 22px 0 10px; border-top: 1px solid var(--line-soft); }

/* ============================ 错题本 ============================ */
.wrong-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0 24px; }
.wrong-toolbar .grow { flex: 1; }
.wrong-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 40px; }
.wrong-card {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 16px;
  padding: 18px 20px; border-radius: 20px;
  background: var(--bg-1); border: 1px solid var(--line-soft);
  align-items: start;
  transition: border-color .2s var(--ease);
}
.wrong-card:hover { border-color: var(--line-var); }
.wrong-card__ch {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: color-mix(in oklab, var(--ch) 14%, transparent);
  color: color-mix(in oklab, var(--ch) 70%, var(--on-bg));
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
}
.wrong-card__stem { font-size: 13.5px; line-height: 1.65; font-weight: 550; }
.wrong-card__meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--on-bg-var); }
.wrong-card__actions { display: flex; gap: 6px; align-items: flex-start; }
.wrong-card__actions .btn { min-height: 34px; padding: 0 12px; font-size: 11.5px; }
.wrong-explain { grid-column: 2 / -1; display: none; padding-top: 12px; border-top: 1px dashed var(--line-var); font-size: 12.5px; color: var(--on-bg-var); line-height: 1.75; }
.wrong-card.is-open .wrong-explain { display: block; }

/* ============================ 速查台 ============================ */
.ref-head { padding: clamp(28px, 5vw, 64px) 0 26px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.ref-head h1 { font-family: var(--font-display); font-size: clamp(36px, 5.2vw, 64px); letter-spacing: .012em; line-height: 1.1; font-weight: 500; margin: 12px 0 10px; }
.ref-head p { color: var(--on-bg-var); font-size: 14px; max-width: 56ch; }
.ref-search { display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 16px; border-radius: 999px; background: var(--bg-1); border: 1px solid var(--line-var); min-width: 240px; }
.ref-search svg { width: 17px; height: 17px; color: var(--on-bg-var); }
.ref-search input { border: 0; background: transparent; outline: 0; font-size: 13px; width: 100%; }
.ref-tabs {
  display: flex; gap: 7px; overflow-x: auto; padding: 4px 40px 20px 0;
  position: sticky; top: 76px; z-index: 25;
  background: var(--bg);
  scrollbar-width: none;
}
.ref-tabs::-webkit-scrollbar { display: none; }
.ref-tabs .chip { flex: none; }
.ref-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; padding-bottom: 30px; }
.ref-card {
  background: var(--bg-1); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: clamp(18px, 2.4vw, 26px);
  min-width: 0;
}
.ref-card--wide { grid-column: span 2; }
.ref-card__num { font-family: var(--font-mono); font-size: 10px; color: var(--on-bg-var); letter-spacing: .08em; }
.ref-card__title { font-family: var(--font-display); font-size: clamp(20px, 2.2vw, 27px); letter-spacing: -.02em; margin: 6px 0 6px; }
.ref-card__lead { font-size: 12px; color: var(--on-bg-var); margin-bottom: 6px; }
.ref-card .blk { margin: 12px 0; font-size: 13.5px; }
.ref-card .blk--formula { padding: 20px 14px; font-size: clamp(15px, 1.6vw, 20px); }
.ref-card table.data { font-size: 12px; }
.ref-card table.data th, .ref-card table.data td { padding: 8px 10px; }
.ref-empty { grid-column: span 2; text-align: center; padding: 60px 20px; color: var(--on-bg-var); font-size: 13px; }
.ref-tip { font-size: 11px; color: var(--on-bg-var); display: flex; gap: 8px; align-items: center; padding-bottom: 28px; }
.ref-tip svg { width: 15px; height: 15px; color: var(--p); }

/* ============================ 搜索命令面板 ============================ */
.cmdk {
  position: fixed; inset: 0; z-index: 200;
  display: flex; justify-content: center; align-items: flex-start;
  padding: min(12vh, 120px) 18px 40px;
  background: color-mix(in oklab, var(--ink) 38%, transparent);
  backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s var(--ease);
}
.cmdk.is-open { opacity: 1; pointer-events: auto; }
.cmdk__panel {
  width: min(720px, 100%);
  max-height: min(72vh, 720px);
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 28px;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .35);
  overflow: hidden;
  transform: translateY(-10px) scale(.985);
  transition: transform .25s var(--ease);
  border: 1px solid var(--line-var);
}
.cmdk.is-open .cmdk__panel { transform: none; }
.cmdk__search { display: flex; align-items: center; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line-soft); }
.cmdk__search svg { width: 21px; height: 21px; color: var(--on-bg-var); flex: none; }
.cmdk__search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; }
.cmdk__search kbd { font-family: var(--font-mono); font-size: 10px; padding: 3px 6px; border-radius: 5px; background: var(--bg-3); color: var(--on-bg-var); }
.cmdk__body { overflow-y: auto; padding: 10px; }
.cmdk__hint { padding: 22px 14px; text-align: center; color: var(--on-bg-var); font-size: 12.5px; }
.cmdk__group { padding: 8px 6px 4px; }
.cmdk__group h5 { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--on-bg-var); padding: 6px 10px; }
.cmdk__item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 12px;
  font-size: 13px; cursor: pointer;
}
.cmdk__item:hover, .cmdk__item.is-active { background: var(--bg-2); }
.cmdk__item.is-active { box-shadow: inset 0 0 0 1px var(--line-var); }
.cmdk__item__icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--p-c); color: var(--on-p-c); flex: none; }
.cmdk__item__icon svg { width: 16px; height: 16px; }
.cmdk__item__main { min-width: 0; flex: 1; }
.cmdk__item__main b { display: block; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk__item__main span { display: block; font-size: 10.5px; color: var(--on-bg-var); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk__item__tag { font-size: 9.5px; color: var(--on-bg-var); border: 1px solid var(--line-var); padding: 2px 7px; border-radius: 99px; flex: none; }
.cmdk__foot { display: flex; gap: 14px; padding: 10px 20px; border-top: 1px solid var(--line-soft); font-size: 10px; color: var(--on-bg-var); }
.cmdk__foot kbd { font-family: var(--font-mono); font-size: 9px; padding: 1px 5px; border-radius: 4px; background: var(--bg-3); margin-right: 4px; }

/* ============================ 搜索结果页 ============================ */
.search-hero { padding: clamp(30px, 6vw, 80px) 0 30px; }
.search-hero h1 { font-family: var(--font-display); font-size: clamp(30px, 4.4vw, 52px); letter-spacing: .012em; font-weight: 500; margin-bottom: 20px; }
.search-box { display: flex; align-items: center; gap: 14px; background: var(--bg-1); border: 1px solid var(--line-var); border-radius: 999px; padding: 8px 8px 8px 22px; max-width: 720px; }
.search-box svg { width: 20px; height: 20px; color: var(--on-bg-var); }
.search-box input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; height: 44px; }
.search-groups { display: flex; flex-direction: column; gap: 26px; padding: 20px 0 60px; }
.search-group h3 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--on-bg-var); margin-bottom: 10px; }
.search-result { display: block; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line-soft); background: var(--bg-1); margin-bottom: 8px; transition: all .2s var(--ease); }
.search-result:hover { border-color: var(--p); background: var(--bg-2); }
.search-result b { font-size: 13.5px; font-weight: 600; }
.search-result p { font-size: 12px; color: var(--on-bg-var); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-result span { font-size: 10.5px; color: var(--on-bg-var); margin-top: 6px; display: inline-block; }

/* 页面底部 */
.site-foot--minimal { margin-top: 60px; }

@media (max-width: 1080px) {
  .stat-card--total { grid-column: span 5; }
  .stat-card--streak { grid-column: span 3; }
  .stat-card--accuracy { grid-column: span 4; }
  .stat-card--week { grid-column: span 7; }
  .stat-card--today { grid-column: span 5; }
  .stat-card--time { grid-column: span 12; }
  .mastery-card { grid-column: span 12; }
  .weak-card { grid-column: span 12; }
  .wafer { grid-template-columns: repeat(4, 1fr); }
  .ref-grid { grid-template-columns: 1fr; }
  .ref-card--wide { grid-column: span 1; }
}
@media (max-width: 720px) {
  .page-head { grid-template-columns: 1fr; align-items: start; }
  .page-head__aside { justify-content: flex-start; }
  .stats-bento { gap: 10px; }
  .stat-card--total, .stat-card--streak, .stat-card--week, .stat-card--accuracy, .stat-card--today, .stat-card--time { grid-column: span 12; }
  .wafer { grid-template-columns: repeat(2, 1fr); }
  .recent-row { grid-template-columns: 1fr auto; }
  .recent-row__time, .recent-row__bar { display: none; }
  .wrong-card { grid-template-columns: 40px minmax(0, 1fr); }
  .wrong-card__actions { grid-column: 2; justify-content: flex-end; }
  .wrong-explain { grid-column: 1 / -1; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__visual { display: none; }
  .hero__title { font-size: clamp(38px, 12vw, 64px); }
  .labs-flex { grid-template-columns: 1fr; }
  .lab-teaser--a, .lab-teaser--b, .lab-teaser--c { grid-column: span 1; }
  .home-progress { grid-template-columns: 1fr; }
  .atlas-grid { grid-template-columns: 1fr; }
  .atlas-side { position: static; }
  .atlas-item { grid-template-columns: 54px minmax(0, 1fr); gap: 14px; }
  .atlas-item__num { font-size: 34px; }
  .atlas-item__stats { display: none; }
  .ch-hero__grid { grid-template-columns: 1fr; }
  .ch-hero__aside { flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; }
  .ch-hero__topics { justify-content: flex-start; }
  .ch-ring { width: 86px; height: 86px; }
  .ch-ring svg { width: 86px; height: 86px; }
  .ch-ring__label b { font-size: 22px; }
  .ch-toc { display: none; }
  .ch-mobile-toc { display: flex; }
  .ch-layout { padding-top: 18px; }
  .ksec__head h2 { font-size: 22px; }
  .blk { font-size: 14.5px; }
  .blk--kv .kv-row { grid-template-columns: 1fr; gap: 3px; }
  .ref-tabs { top: 64px; }
  .wrong-card { padding: 14px; }
  .cmdk { padding-top: 7vh; }
}
