/* 海淀小学伴学私教 · 护眼纸面编辑风（遵循前端审美准则：高对比 >=4.5:1、逻辑属性、tabular-nums、零外部字体） */

:where(*, *::before, *::after) {
  box-sizing: border-box;
}

:root {
  --paper: #f7f5ee;
  --surface: #ffffff;
  --surface-soft: #f1eee4;
  --ink: #1b2421;
  --muted: #50605b;
  --border: #cfc9b8;
  --border-strong: #8d9c97;

  --forest: #175848;
  --forest-dark: #104236;
  --forest-soft: #e4f2ed;

  --ok-text: #0b5e45;
  --ok-bg: #e3f5ec;
  --ok-border: #2f9b74;

  --err-text: #8f2a20;
  --err-bg: #fdecea;
  --err-border: #c4473a;

  --warn-text: #7a4e00;
  --warn-bg: #fff4dc;
  --warn-border: #c58a14;

  --neu-text: #425450;
  --neu-bg: #eef2f1;
  --neu-border: #8fa39f;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(20, 35, 30, 0.06);
  --shadow-md: 0 6px 20px rgba(20, 35, 30, 0.09);
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.hpt-sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid #175848;
  outline-offset: 2px;
}

/* ============ Header & Nav ============ */
.hpt-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-block-end: 1px solid var(--border);
}

.hpt-header-inner {
  max-inline-size: 1320px;
  margin-inline: auto;
  padding-inline: 20px;
  padding-block: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hpt-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-inline-size: 0;
}

.hpt-logo {
  flex: 0 0 40px;
  inline-size: 40px;
  block-size: 40px;
  border-radius: 10px;
  background: var(--forest);
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
  display: grid;
  place-items: center;
}

.hpt-brand-text h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  color: var(--ink);
}

.hpt-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.hpt-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hpt-grade-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding-inline: 10px;
  padding-block: 4px;
}

.hpt-picker-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.hpt-grade-picker select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--forest);
  cursor: pointer;
  min-block-size: 32px;
}

.hpt-nav {
  max-inline-size: 1320px;
  margin-inline: auto;
  padding-inline: 20px;
  display: flex;
  gap: 6px;
  border-block-start: 1px solid #ece8dc;
}

.hpt-nav-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding-inline: 14px;
  padding-block: 11px;
  cursor: pointer;
  border-block-end: 3px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.hpt-nav-btn:hover {
  color: var(--ink);
}

.hpt-nav-btn.is-active {
  color: var(--forest);
  border-block-end-color: var(--forest);
}

.hpt-badge-count {
  display: inline-grid;
  place-items: center;
  min-inline-size: 20px;
  block-size: 20px;
  padding-inline: 6px;
  border-radius: 999px;
  background: var(--err-border);
  color: #ffffff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ============ Main Layout ============ */
.hpt-main {
  max-inline-size: 1320px;
  margin-inline: auto;
  padding-inline: 20px;
  padding-block: 18px 40px;
}

[hidden] {
  display: none !important;
}

/* Hero & KPI Strip */
.hpt-hero-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  margin-block-end: 16px;
}

.hpt-hero-copy h2 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.35;
}

.hpt-hero-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.hpt-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hpt-kpi {
  background: var(--surface-soft);
  border: 1px solid #e2ddd0;
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.hpt-kpi strong {
  display: block;
  font-size: 19px;
  line-height: 1.2;
  color: var(--forest);
  font-variant-numeric: tabular-nums;
}

.hpt-kpi span {
  display: block;
  margin-block-start: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

/* Controls Card */
.hpt-controls-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-block-end: 16px;
}

.hpt-subject-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-end: 12px;
}

.hpt-subj-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  min-block-size: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hpt-subj-btn .hpt-subj-cnt {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hpt-subj-btn.is-active {
  background: var(--forest);
  border-color: var(--forest);
  color: #ffffff;
}

.hpt-subj-btn.is-active .hpt-subj-cnt {
  color: #d6efe7;
}

.hpt-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.hpt-grade-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hpt-mini-pill {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  min-block-size: 36px;
  white-space: nowrap;
}

.hpt-mini-pill.is-active {
  background: var(--forest-soft);
  border-color: var(--forest);
  color: var(--forest-dark);
  font-weight: 700;
}

.hpt-edition-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 999px;
  padding: 3px 6px 3px 12px;
}

.hpt-edition-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--warn-text);
  white-space: nowrap;
}

.hpt-seg {
  display: inline-flex;
  gap: 2px;
}

.hpt-seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--warn-text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  min-block-size: 30px;
}

.hpt-seg-btn.is-active {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.hpt-search-wrap {
  position: relative;
  flex: 1 1 240px;
  min-inline-size: 200px;
}

.hpt-search-wrap input {
  inline-size: 100%;
  min-block-size: 40px;
  padding-inline: 12px 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
}

.hpt-clear-btn {
  position: absolute;
  inset-inline-end: 6px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  inline-size: 28px;
  block-size: 28px;
  border-radius: 50%;
}

.hpt-notice {
  margin-block-start: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-inline-start: 4px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 13px;
}

.hpt-notice-info {
  border-inline-start-color: var(--forest);
  background: var(--forest-soft);
  color: var(--forest-dark);
}

/* ============ Two-Column Browse Grid ============ */
.hpt-browse-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: start;
}

.hpt-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-block-end: 10px;
  flex-wrap: wrap;
}

.hpt-col-head h3 {
  margin: 0;
  font-size: 16px;
}

.hpt-sem-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hpt-catalog-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hpt-unit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.hpt-unit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-block-end: 6px;
}

.hpt-unit-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.hpt-unit-sem {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.hpt-unit-tip {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--warn-text);
  background: var(--warn-bg);
  padding: 6px 10px;
  border-radius: 6px;
  border-inline-start: 3px solid var(--warn-border);
}

.hpt-topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hpt-topic-chip {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface-soft);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-block-size: 38px;
  text-align: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hpt-topic-chip:hover {
  border-color: var(--forest);
  background: var(--forest-soft);
}

.hpt-topic-chip.is-selected {
  background: var(--forest);
  border-color: var(--forest);
  color: #ffffff;
  font-weight: 600;
}

.hpt-topic-chip.is-mastered:not(.is-selected) {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-text);
}

/* ============ Detail Coaching Card ============ */
.hpt-detail-col {
  position: sticky;
  inset-block-start: 118px;
  scroll-margin-block-start: 78px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-md);
  max-block-size: calc(100vh - 136px);
  overflow-y: auto;
}

.hpt-detail-placeholder {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}

.hpt-placeholder-icon {
  font-size: 32px;
  margin: 0 0 8px;
}

.hpt-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-block-end: 12px;
  border-block-end: 1px solid #ebe6d9;
  margin-block-end: 14px;
}

.hpt-detail-head h2 {
  margin: 4px 0 4px;
  font-size: 20px;
  line-height: 1.3;
}

.hpt-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hpt-tag {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--neu-bg);
  color: var(--neu-text);
  border: 1px solid #d5dedb;
}

.hpt-tag-forest {
  background: var(--forest-soft);
  color: var(--forest-dark);
  border-color: #a9d5c6;
}

.hpt-tag-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-color: var(--ok-border);
}

.hpt-tag-err {
  background: var(--err-bg);
  color: var(--err-text);
  border-color: var(--err-border);
}

.hpt-tag-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.hpt-section-block {
  margin-block-end: 16px;
}

.hpt-section-block h4 {
  margin: 0 0 8px;
  font-size: 14.5px;
  color: var(--forest-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hpt-plain-box {
  background: var(--forest-soft);
  border-inline-start: 4px solid var(--forest);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14.5px;
  color: var(--ink);
}

.hpt-oral-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.hpt-oral-q {
  margin: 0 0 8px;
  font-weight: 600;
}

.hpt-oral-box details summary {
  cursor: pointer;
  color: var(--forest);
  font-weight: 600;
  font-size: 13.5px;
}

.hpt-oral-a {
  margin: 8px 0 0;
  padding-block-start: 8px;
  border-block-start: 1px dashed var(--border-strong);
  color: var(--ok-text);
  font-weight: 600;
}

.hpt-steps-list {
  display: grid;
  gap: 8px;
}

.hpt-step-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.hpt-step-item strong {
  display: block;
  font-size: 13px;
  color: var(--forest);
  margin-block-end: 4px;
}

.hpt-step-item p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink);
}

.hpt-prereq-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hpt-pre-btn {
  appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  min-block-size: 36px;
}

.hpt-pre-hard {
  background: var(--err-bg);
  color: var(--err-text);
  border: 1px solid var(--err-border);
}

.hpt-pre-soft {
  background: var(--neu-bg);
  color: var(--neu-text);
  border: 1px solid var(--neu-border);
}

.hpt-graph-wrap {
  margin-block-start: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfaf5;
  overflow: hidden;
}

.hpt-graph-canvas {
  inline-size: 100%;
  block-size: 270px;
}

.hpt-graph-legend {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
  border-block-start: 1px solid #ebe6d9;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Practice Questions inside Detail Card */
.hpt-practice-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #fdfcf9;
  margin-block-end: 10px;
}

.hpt-q-prompt {
  margin: 0 0 10px;
  font-weight: 600;
  font-size: 14.5px;
}

.hpt-q-figure {
  margin: 0 0 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid #ebe6d9;
  background: #ffffff;
  color: var(--ink);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.hpt-q-figure svg {
  max-inline-size: min(100%, 340px);
  max-block-size: 190px;
  inline-size: auto;
  block-size: auto;
  display: block;
}

.hpt-choices {
  display: grid;
  gap: 8px;
}

.hpt-choices.has-figures {
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
}

.hpt-choice-btn.has-figure {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  gap: 6px;
}

.hpt-choice-figure {
  color: var(--ink);
  display: flex;
  justify-content: center;
  align-items: center;
}

.hpt-choice-figure svg {
  max-inline-size: 118px;
  max-block-size: 92px;
  inline-size: auto;
  block-size: auto;
  display: block;
}

.hpt-backtrack-banner {
  margin-block-end: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn-text);
  font-size: 13px;
  font-weight: 600;
}

.hpt-choice-btn {
  appearance: none;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  text-align: start;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-block-size: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hpt-choice-btn:hover:not(:disabled) {
  border-color: var(--forest);
  background: var(--forest-soft);
}

.hpt-choice-key {
  flex: 0 0 26px;
  inline-size: 26px;
  block-size: 26px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12.5px;
}

.hpt-choice-btn.is-correct {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok-text);
  font-weight: 600;
}

.hpt-choice-btn.is-wrong {
  background: var(--err-bg);
  border-color: var(--err-border);
  color: var(--err-text);
}

.hpt-q-feedback {
  margin-block-start: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
}

.hpt-q-feedback.is-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
  border-inline-start: 4px solid var(--ok-border);
}

.hpt-q-feedback.is-err {
  background: var(--err-bg);
  color: var(--err-text);
  border-inline-start: 4px solid var(--err-border);
}

.hpt-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-block-start: 12px;
  border-block-start: 1px solid #ebe6d9;
}

/* ============ Buttons ============ */
.hpt-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 15px;
  cursor: pointer;
  min-block-size: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.hpt-btn-primary {
  background: var(--forest);
  color: #ffffff;
}

.hpt-btn-primary:hover {
  background: var(--forest-dark);
}

.hpt-btn-secondary {
  background: var(--forest-soft);
  color: var(--forest-dark);
  border-color: #96cbb8;
}

.hpt-btn-secondary:hover {
  background: #d3eae2;
}

.hpt-btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
}

.hpt-btn-ghost:hover {
  background: var(--surface-soft);
}

.hpt-btn-sm {
  min-block-size: 34px;
  padding: 5px 11px;
  font-size: 13px;
}

.hpt-link-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--forest);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 4px;
}

/* ============ Panels (Diagnose / Tutor / Wrongbook) ============ */
.hpt-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-block-end: 16px;
}

.hpt-panel-head h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.hpt-panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.hpt-diag-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-block: 18px;
}

.hpt-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hpt-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.hpt-field select,
.hpt-field input {
  min-block-size: 42px;
  padding-inline: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
}

.hpt-diag-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.hpt-muted-inline {
  font-size: 13px;
  color: var(--muted);
}

.hpt-diag-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-block-end: 10px;
  flex-wrap: wrap;
}

.hpt-pill-strong {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--forest);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-inline-end: 8px;
}

.hpt-progress-track {
  inline-size: 100%;
  block-size: 8px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-block-end: 16px;
}

.hpt-progress-fill {
  block-size: 100%;
  inline-size: 0%;
  background: var(--forest);
  transition: inline-size 0.25s ease;
}

.hpt-question-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  background: #fdfcf9;
}

.hpt-input-answer-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hpt-input-answer-row input {
  flex: 1 1 220px;
  min-block-size: 44px;
  padding-inline: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
}

.hpt-report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-block: 16px;
}

.hpt-report-list {
  display: grid;
  gap: 10px;
  margin-block: 14px;
}

.hpt-root-card {
  border: 1px solid var(--err-border);
  background: var(--err-bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hpt-path-card {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============ AI Tutor ============ */
.hpt-tutor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-end: 12px;
}

.hpt-status-chip {
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 12px;
  white-space: normal;
  max-inline-size: 100%;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.hpt-status-chip.is-live {
  background: var(--ok-bg);
  color: var(--ok-text);
  border: 1px solid var(--ok-border);
}

.hpt-status-chip.is-neutral {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.hpt-context-bar {
  background: var(--forest-soft);
  border: 1px solid #a9d5c6;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--forest-dark);
  margin-block-end: 12px;
}

.hpt-mode-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-block-end: 14px;
}

.hpt-chat-log {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fbfaf5;
  padding: 14px;
  min-block-size: 240px;
  max-block-size: 460px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-block-end: 12px;
}

.hpt-msg {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.65;
  word-break: break-word;
}

.hpt-msg-body {
  margin: 4px 0 0;
  white-space: pre-wrap;
}

.hpt-msg-p {
  margin: 4px 0 8px;
}

.hpt-msg-ai {
  background: var(--surface);
  border: 1px solid var(--border);
  align-self: flex-start;
  max-inline-size: 94%;
}

.hpt-msg-user {
  background: var(--forest);
  color: #ffffff;
  align-self: flex-end;
  max-inline-size: 88%;
}

.hpt-sample-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 8px;
}

.hpt-sample-chip {
  appearance: none;
  border: 1px solid #a9d5c6;
  background: var(--forest-soft);
  color: var(--forest-dark);
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: start;
}

.hpt-matched-strip {
  margin-block-end: 12px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.hpt-tutor-form textarea {
  inline-size: 100%;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  resize: vertical;
  margin-block-end: 10px;
}

.hpt-tutor-form-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

/* ============ Wrongbook ============ */
.hpt-wb-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-block: 14px;
}

.hpt-wb-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hpt-wb-list {
  display: grid;
  gap: 12px;
}

.hpt-wb-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: #fdfcf9;
}

.hpt-wb-card.is-done {
  opacity: 0.72;
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

/* ============ Footer & Dialog & Toast ============ */
.hpt-footer {
  border-block-start: 1px solid var(--border);
  background: var(--surface);
  padding-inline: 20px;
  padding-block: 20px 32px;
}

.hpt-footer-inner {
  max-inline-size: 1320px;
  margin-inline: auto;
  font-size: 12.5px;
  color: var(--muted);
}

.hpt-footer-inner a {
  color: var(--forest);
  font-weight: 600;
}

.hpt-footer-note {
  margin-block-start: 6px;
}

.hpt-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-inline-size: 520px;
  inline-size: calc(100% - 28px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22);
}

.hpt-dialog::backdrop {
  background: rgba(15, 25, 22, 0.48);
}

.hpt-dialog-box {
  background: var(--surface);
  padding: 18px 20px;
}

.hpt-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-block-end: 12px;
}

.hpt-dialog-head h3 {
  margin: 0;
  font-size: 17px;
}

.hpt-icon-close {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  inline-size: 34px;
  block-size: 34px;
  border-radius: 50%;
  color: var(--muted);
}

.hpt-dialog-body {
  display: grid;
  gap: 12px;
  margin-block-end: 16px;
}

.hpt-dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.hpt-toast {
  position: fixed;
  inset-inline-start: 50%;
  inset-block-end: 78px;
  transform: translateX(-50%);
  background: #1b2421;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  z-index: 60;
  box-shadow: var(--shadow-md);
  max-inline-size: calc(100vw - 32px);
  text-align: center;
}

/* Mobile Bottom Nav (hidden on desktop) */
.hpt-bottom-nav {
  display: none;
}

@media (max-width: 980px) {
  .hpt-hero-strip {
    grid-template-columns: 1fr;
  }
  .hpt-browse-grid {
    grid-template-columns: 1fr;
  }
  .hpt-detail-col {
    position: static;
    max-block-size: none;
  }
  .hpt-diag-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .hpt-header-inner {
    padding-inline: 12px;
    padding-block: 10px;
  }
  .hpt-subtitle {
    display: none;
  }
  .hpt-brand-text h1 {
    font-size: 16px;
  }
  .hpt-picker-label {
    display: none;
  }
  .hpt-nav {
    display: none;
  }
  .hpt-main {
    padding-inline: 12px;
    padding-block: 12px 86px;
  }
  .hpt-footer {
    padding-block-end: 86px;
  }
  .hpt-kpi-row,
  .hpt-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hpt-edition-toggle {
    inline-size: 100%;
    justify-content: space-between;
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    gap: 6px;
  }
  .hpt-seg-btn {
    white-space: nowrap;
    padding: 5px 9px;
    font-size: 12px;
  }
  .hpt-tutor-form-bar {
    flex-direction: column;
  }
  .hpt-tutor-form-bar .hpt-btn {
    inline-size: 100%;
  }
  .hpt-bottom-nav {
    position: fixed;
    inset-block-end: 0;
    inset-inline: 0;
    z-index: 40;
    background: rgba(255, 255, 255, 0.98);
    border-block-start: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-block: 6px calc(6px + env(safe-area-inset-bottom));
  }
  .hpt-bnav-btn {
    position: relative;
    appearance: none;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding-block: 4px;
    cursor: pointer;
    min-block-size: 44px;
  }
  .hpt-bnav-badge {
    position: absolute;
    inset-block-start: 2px;
    inset-inline-end: calc(50% - 26px);
    min-inline-size: 18px;
    block-size: 18px;
    padding-inline: 5px;
    border-radius: 999px;
    background: var(--err-border);
    color: #ffffff;
    font-size: 10.5px;
    font-weight: 700;
    display: inline-grid;
    place-items: center;
    font-variant-numeric: tabular-nums;
  }
  .hpt-bnav-btn span:first-child {
    font-size: 18px;
    line-height: 1.1;
  }
  .hpt-bnav-btn.is-active {
    color: var(--forest);
  }
}
