/* 历史做题记录：沿用学练岛色系，卡片化布局，手机/桌面自适应 */
#history-records-view.history-records-screen {
  --hx-canvas: #f3f4f9;
  --hx-surface: #ffffff;
  --hx-ink: #1d2233;
  --hx-muted: #5b6472;
  --hx-faint: #9aa1b2;
  --hx-line: #e7e9f1;
  --hx-primary: #5b5ff0;
  --hx-primary-strong: #4a4ee8;
  --hx-primary-tint: rgba(91, 95, 240, 0.1);
  min-height: 100vh;
  background: var(--hx-canvas);
  color: var(--hx-ink);
  font-family: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding: 26px 34px 48px 230px;
}
#history-records-view * { box-sizing: border-box; }

#history-records-view .hr-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
#history-records-view .hr-back {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--hx-line);
  border-radius: 12px;
  background: var(--hx-surface);
  color: var(--hx-muted);
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s, background 0.16s;
}
#history-records-view .hr-back:hover { color: var(--hx-primary); border-color: var(--hx-primary); }
#history-records-view .hr-header h1 { margin: 0; font-size: 22px; font-weight: 800; }

#history-records-view .hr-scroll { display: flex; flex-direction: column; gap: 22px; max-width: 980px; }
#history-records-view h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 800;
  color: var(--hx-ink);
}

#history-records-view .hr-draft-list,
#history-records-view .hr-record-list { display: flex; flex-direction: column; gap: 12px; }

#history-records-view .hr-draft-card,
#history-records-view .hr-record-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid var(--hx-line);
  border-radius: 15px;
  background: var(--hx-surface);
  padding: 16px 18px;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
#history-records-view .hr-draft-card {
  border-color: rgba(91, 95, 240, 0.35);
  background: linear-gradient(180deg, #f6f7ff, #ffffff);
}
#history-records-view .hr-draft-card:hover,
#history-records-view .hr-record-card:hover {
  border-color: rgba(91, 95, 240, 0.45);
  box-shadow: 0 12px 28px rgba(91, 95, 240, 0.1);
  transform: translateY(-2px);
}
#history-records-view .hr-draft-card strong,
#history-records-view .hr-record-card strong { font-size: 15px; font-weight: 700; }
#history-records-view .hr-record-card small { font-size: 12.5px; color: var(--hx-faint); font-weight: 600; }
#history-records-view .hr-draft-card p,
#history-records-view .hr-record-card p {
  margin: 0;
  font-size: 13px;
  color: var(--hx-muted);
  font-weight: 600;
  line-height: 1.5;
}
#history-records-view .hr-draft-card small { font-size: 12.5px; color: var(--hx-primary); font-weight: 700; }

#history-records-view .hr-btn {
  align-self: flex-start;
  margin-top: 4px;
  border-radius: 11px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.16s;
}
#history-records-view .hr-btn-ghost {
  border: 1px solid var(--hx-line);
  background: #fff;
  color: var(--hx-muted);
}
#history-records-view .hr-btn-ghost:hover { border-color: var(--hx-primary); color: var(--hx-primary); }
#history-records-view .hr-btn-primary {
  border: 1px solid var(--hx-primary);
  background: var(--hx-primary);
  color: #fff;
}
#history-records-view .hr-btn-primary:hover { background: var(--hx-primary-strong); border-color: var(--hx-primary-strong); transform: translateY(-1px); }

#history-records-view .hr-empty,
#history-records-view .hr-loading {
  margin: 0;
  border: 1px dashed var(--hx-line);
  border-radius: 14px;
  background: var(--hx-surface);
  padding: 30px;
  text-align: center;
  color: var(--hx-faint);
  font-weight: 600;
}
#history-records-view .hr-error-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--hx-line);
  border-radius: 14px;
  background: var(--hx-surface);
  padding: 26px;
}
#history-records-view .hr-error-box p { margin: 0; color: var(--hx-muted); font-weight: 600; }

/* ===== 手机端：收窄留白，按钮占满，去掉桌面侧栏预留 ===== */
@media (max-width: 640px) {
  #history-records-view.history-records-screen { padding: 16px 14px 36px; font-size: 14px; }
  #history-records-view .hr-header h1 { font-size: 19px; }
  #history-records-view .hr-scroll { gap: 18px; }
  #history-records-view .hr-draft-card,
  #history-records-view .hr-record-card { padding: 14px 15px; }
  #history-records-view .hr-btn { align-self: stretch; text-align: center; }
}

/* ================= 手机端：暖橙皮肤 + 阅读化布局（桌面端不受影响） ================= */
#history-records-view .hr-m-head,
#history-records-view .hr-m-bar,
#history-records-view .hr-m-summary { display: none; }

@media (max-width: 640px) {
  #history-records-view.history-records-screen {
    --hx-canvas: #F7F2E8;
    --hx-surface: #FFFDFA;
    --hx-ink: #3B3228;
    --hx-muted: #7E6E5A;
    --hx-faint: #A2917B;
    --hx-line: #EFE3D0;
    --hx-primary: #E08A2E;
    --hx-primary-strong: #C9761F;
    --hx-primary-tint: rgba(224, 138, 46, .12);
    min-height: 100vh;
    padding: 0 0 26px;
    background:
      radial-gradient(620px 320px at 8% -6%, #FCE7CB 0%, rgba(252, 231, 203, 0) 70%),
      #F7F2E8;
    font-size: 15px;
  }

  /* 页头 */
  #history-records-view .hr-header {
    gap: 10px;
    padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
    margin: 0;
  }
  #history-records-view .hr-back {
    width: 40px; height: 40px;
    border-radius: 14px;
    border: 1px solid #EFE3D0;
    background: #fff;
    color: #8A7660;
    box-shadow: 0 2px 6px rgba(150, 110, 60, .08);
  }
  #history-records-view .hr-header h1 { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }

  #history-records-view .hr-scroll { gap: 14px; padding: 0 16px; max-width: none; }

  /* 汇总条 */
  #history-records-view .hr-m-summary {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 15px;
    border-radius: 16px;
    border: 1px solid #F2E4CE;
    background: linear-gradient(135deg, #FFF6E7 0%, #FFFDF9 62%, #FDF1E4 100%);
    box-shadow: 0 8px 20px -16px rgba(150, 105, 45, .8);
  }
  #history-records-view .hr-m-sum-t { font-size: 13.5px; font-weight: 700; color: #6B5A45; }
  #history-records-view .hr-m-sum-s { font-size: 12.5px; font-weight: 700; color: #B87225; }

  /* 分组标题 */
  #history-records-view h2 {
    margin: 6px 2px 9px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .2px;
    color: #9A8A74;
  }

  #history-records-view .hr-draft-list,
  #history-records-view .hr-record-list { gap: 11px; }

  #history-records-view .hr-draft-card,
  #history-records-view .hr-record-card {
    gap: 6px;
    padding: 15px;
    border-radius: 18px;
    border: 1px solid #F0E4D1;
    background: #FFFDFA;
    box-shadow: 0 10px 22px -20px rgba(120, 88, 48, .9);
  }
  #history-records-view .hr-draft-card {
    border-color: #F5DDBB;
    background: linear-gradient(170deg, #FFF8EC 0%, #FFFDFA 58%);
  }
  #history-records-view .hr-draft-card:hover,
  #history-records-view .hr-record-card:hover { transform: none; box-shadow: 0 10px 22px -20px rgba(120, 88, 48, .9); border-color: #F0E4D1; }

  /* 手机信息头 */
  #history-records-view .hr-m-head { display: flex; align-items: center; gap: 7px; }
  #history-records-view .hr-m-subj {
    font-size: 11.5px; font-weight: 800; letter-spacing: .3px;
    color: #A9631A; background: #FFF0DA;
    padding: 4px 9px; border-radius: 8px;
  }
  #history-records-view .hr-m-type { font-size: 13px; font-weight: 700; color: #5C4C3A; }
  #history-records-view .hr-m-flag {
    margin-left: auto; font-size: 11px; font-weight: 800;
    color: #C2622C; background: #FDECE2; padding: 3px 8px; border-radius: 7px;
  }
  #history-records-view .hr-m-rate {
    margin-left: auto;
    font-size: 23px; font-weight: 800; letter-spacing: -.6px;
    color: #B87225; font-variant-numeric: tabular-nums;
  }
  #history-records-view .hr-record-card .hr-m-rate.is-low { color: #C2502C; }

  /* 正文层级 */
  #history-records-view .hr-record-card strong {
    display: block;
    font-size: 12.5px; font-weight: 600; color: #A2917B;
    line-height: 1.5;
  }
  #history-records-view .hr-draft-card strong { font-size: 14px; font-weight: 700; color: #4A3E32; }
  #history-records-view .hr-record-card p,
  #history-records-view .hr-draft-card p {
    font-size: 13px; font-weight: 600; color: #6B5A45; line-height: 1.55;
  }
  #history-records-view .hr-record-card small { font-size: 11.5px; color: #B0A08A; font-weight: 600; }
  #history-records-view .hr-draft-card small { font-size: 12px; color: #B87225; font-weight: 700; }

  /* 正确率进度条 */
  #history-records-view .hr-m-bar {
    display: block; height: 6px; margin: 4px 0 2px;
    border-radius: 99px; background: #F2E8D8; overflow: hidden;
  }
  #history-records-view .hr-m-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #F0B05C, #E08A2E); }
  #history-records-view .hr-m-bar.is-low i { background: linear-gradient(90deg, #E8A277, #CE5C36); }

  /* 按钮 */
  #history-records-view .hr-btn {
    align-self: stretch; text-align: center;
    margin-top: 8px;
    min-height: 44px;
    border-radius: 14px;
    font-size: 14px; font-weight: 800;
  }
  #history-records-view .hr-btn-ghost {
    border: 1px solid #F3E0C6; background: #FFF6E9; color: #B87225;
  }
  #history-records-view .hr-btn-ghost:hover { border-color: #E8BF85; color: #A9631A; }
  #history-records-view .hr-btn-primary {
    border: 1px solid transparent;
    background: linear-gradient(135deg, #F0A44C, #E08A2E);
    color: #fff;
    box-shadow: 0 10px 20px -12px rgba(224, 138, 46, .9), inset 0 1px 0 rgba(255, 255, 255, .45);
  }

  #history-records-view .hr-empty,
  #history-records-view .hr-loading {
    border: 1px dashed #E9DCC6; background: #FFFDFA; color: #A2917B; border-radius: 16px;
  }
  #history-records-view .hr-error-box { border: 1px solid #F0E4D1; background: #FFFDFA; border-radius: 16px; }
}

/* 手机端卡片信息层级：教材 + 数据时间各一行，去掉重复的类型与长日期 */
#history-records-view .hr-m-book,
#history-records-view .hr-m-meta { display: none; }
@media (max-width: 640px) {
  #history-records-view .hr-record-card > strong,
  #history-records-view .hr-record-card > small,
  #history-records-view .hr-record-card > p { display: none; }
  #history-records-view .hr-m-book {
    display: block;
    font-size: 12.5px; font-weight: 600; color: #A2917B; line-height: 1.45;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #history-records-view .hr-m-meta {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 2px;
  }
  #history-records-view .hr-m-ans { font-size: 13px; font-weight: 700; color: #6B5A45; }
  #history-records-view .hr-m-time { font-size: 11.5px; font-weight: 600; color: #B0A08A; }
  #history-records-view .hr-m-bar { margin: 6px 0 0; }
  #history-records-view .hr-btn { margin-top: 10px; min-height: 42px; }
}
