:root {
  --hb-bg: #f6f8fb;
  --hb-panel: #ffffff;
  --hb-border: #d9e2ec;
  --hb-border-strong: #bfd0e0;
  --hb-text: #102033;
  --hb-muted: #4f6277;
  --hb-accent: #1d4ed8;
  --hb-accent-soft: #eef4ff;
  --hb-good: #0f766e;
  --hb-good-soft: #e8f8f1;
  --hb-warn: #9a3412;
  --hb-warn-soft: #fff4ed;
  --hb-shadow: 0 18px 40px rgba(16, 32, 51, 0.06);
  --hb-radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.hb-page {
  margin: 0;
  background: linear-gradient(180deg, #f8fbff 0%, var(--hb-bg) 100%);
  color: var(--hb-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.7;
}

a {
  color: var(--hb-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.hb-topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(191, 208, 224, 0.7);
  background: rgba(255, 255, 255, 0.94);
  position: sticky;
  top: 0;
  z-index: 20;
}

.hb-brand {
  font-weight: 800;
  color: var(--hb-text);
}

.hb-topbar__links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hb-breadcrumb {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1rem 1.5rem 0;
  color: var(--hb-muted);
  font-size: 0.95rem;
}

.hb-breadcrumb span {
  margin: 0 0.35rem;
}

.hb-page-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1.5rem;
}

.hb-sidebar {
  align-self: start;
  position: sticky;
  top: 5.25rem;
  display: grid;
  gap: 1rem;
}

.hb-sidebar__box,
.hb-main > section,
.hb-progress-card,
.hb-quiz-card,
.hb-review-block,
.hb-simulator,
.hb-hero-card {
  background: var(--hb-panel);
  border: 1px solid var(--hb-border);
  border-radius: var(--hb-radius);
  box-shadow: var(--hb-shadow);
}

.hb-sidebar__box {
  padding: 1rem;
}

.hb-sidebar__eyebrow,
.hb-eyebrow {
  margin: 0 0 0.35rem;
  color: var(--hb-muted);
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hb-sidebar__title {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.45;
  margin-bottom: 0.8rem;
  color: var(--hb-text);
}

.hb-sidebar__progress {
  display: inline-flex;
  min-width: 84px;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  background: var(--hb-accent-soft);
  border-radius: 999px;
  color: var(--hb-accent);
  font-weight: 800;
}

.hb-sidebar__progress-text {
  margin: 0.6rem 0 0;
  color: var(--hb-muted);
}

.hb-course-nav {
  display: grid;
  gap: 0.55rem;
}

.hb-course-nav__item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  background: var(--hb-panel);
  border: 1px solid var(--hb-border);
  border-radius: 14px;
  color: var(--hb-text);
}

.hb-course-nav__item:hover {
  border-color: var(--hb-border-strong);
  text-decoration: none;
}

.hb-course-nav__item.is-active {
  background: var(--hb-accent-soft);
  border-color: rgba(29, 78, 216, 0.24);
}

.hb-course-nav__index {
  font-weight: 800;
  color: var(--hb-muted);
}

.hb-course-nav__label {
  font-weight: 700;
}

.hb-course-nav__count {
  color: var(--hb-muted);
  font-size: 0.92rem;
}

.hb-back-link {
  color: var(--hb-muted);
  font-weight: 600;
}

.hb-main {
  min-width: 0;
}

.hb-main > h1,
.hb-main > p.hb-lead,
.hb-main > .hb-chapter-meta,
.hb-main > .hb-noscript-note,
.hb-main > .hb-progress-card,
.hb-main > .hb-button-row,
.hb-main > .hb-chapter-nav {
  margin-bottom: 1rem;
}

.hb-main h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.9rem, 3vw, 3rem);
  line-height: 1.2;
}

.hb-lead {
  margin: 0;
  color: var(--hb-muted);
  font-size: 1.06rem;
}

.hb-chapter-meta {
  margin: 0;
  color: var(--hb-muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.hb-noscript-note {
  margin: 0;
  color: var(--hb-muted);
  font-size: 0.94rem;
}

.hb-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 1rem;
  padding: 1.2rem;
  margin-bottom: 1.25rem;
}

.hb-hero-card__copy h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.hb-hero-card__copy p {
  margin: 0 0 0.85rem;
}

.hb-hero-card__media {
  margin: 0;
  display: flex;
  align-items: center;
}

.hb-hero-card__media img,
.hb-figure img {
  width: 100%;
  height: auto;
  display: block;
}

.hb-stat-list {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin: 0.9rem 0 1rem;
}

.hb-stat-list span,
.hb-pill-grid span {
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #24415f;
  font-weight: 700;
  font-size: 0.92rem;
}

.hb-button-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hb-button-row--wrap {
  margin-bottom: 1rem;
}

.hb-button {
  appearance: none;
  border: 1px solid transparent;
  background: var(--hb-accent);
  color: #ffffff;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.97rem;
  cursor: pointer;
}

.hb-button:hover {
  text-decoration: none;
  filter: brightness(0.97);
}

.hb-button--ghost {
  background: transparent;
  color: var(--hb-text);
  border-color: var(--hb-border-strong);
}

.hb-section {
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.hb-section h2,
.hb-practice h2 {
  margin-top: 0;
  font-size: 1.35rem;
}

.hb-bullet-list,
.hb-ordered-list,
.hb-key-list {
  margin: 0.6rem 0 0;
  padding-left: 1.25rem;
}

.hb-key-list {
  display: grid;
  gap: 0.85rem;
  padding-left: 0;
  list-style: none;
}

.hb-key-list li {
  padding: 1rem;
  background: #f9fbfd;
  border: 1px solid var(--hb-border);
  border-radius: 14px;
}

.hb-key-list strong {
  display: block;
  margin-bottom: 0.25rem;
}

.hb-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.65rem 0 0.95rem;
}

.hb-callout {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8fbfe;
  border: 1px solid var(--hb-border);
  border-left: 4px solid var(--hb-accent);
  border-radius: 14px;
}

.hb-callout--accent {
  background: var(--hb-accent-soft);
}

.hb-callout strong {
  display: block;
  margin-bottom: 0.35rem;
}

.hb-figure {
  margin: 0 0 1rem;
}

.hb-table {
  width: 100%;
  border-collapse: collapse;
}

.hb-table th,
.hb-table td {
  padding: 0.8rem;
  border-bottom: 1px solid var(--hb-border);
  text-align: left;
  vertical-align: top;
}

.hb-table th {
  width: 220px;
  color: var(--hb-text);
  font-size: 0.96rem;
}

.hb-progress-card {
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.hb-progress-card strong {
  display: block;
  margin-bottom: 0.25rem;
}

.hb-progress-card p {
  margin: 0;
  color: var(--hb-muted);
}

.hb-progress-card code {
  font-size: 0.92rem;
}

.hb-practice {
  margin: 1rem 0;
}

.hb-section-heading {
  margin-bottom: 1rem;
}

.hb-section-heading h2 {
  margin: 0;
}

.hb-section-heading p:last-child {
  margin-bottom: 0;
}

.hb-quiz-stack {
  display: grid;
  gap: 1rem;
}

.hb-quiz-card {
  padding: 1rem;
}

.hb-quiz-card__header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 0.95rem;
}

.hb-quiz-card__meta {
  color: var(--hb-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.hb-quiz-card h3 {
  margin: 0.1rem 0 0;
  font-size: 1.08rem;
  line-height: 1.45;
}

.hb-status-pill {
  flex-shrink: 0;
  padding: 0.3rem 0.72rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 800;
  border: 1px solid var(--hb-border);
  background: #f8fafc;
  color: var(--hb-muted);
}

.hb-status-pill.is-correct {
  color: var(--hb-good);
  background: var(--hb-good-soft);
  border-color: rgba(15, 118, 110, 0.25);
}

.hb-status-pill.is-retry {
  color: var(--hb-warn);
  background: var(--hb-warn-soft);
  border-color: rgba(154, 52, 18, 0.2);
}

.hb-status-pill.is-pending {
  color: var(--hb-muted);
}

.hb-options {
  display: grid;
  gap: 0.75rem;
}

.hb-option {
  display: flex;
  gap: 0.7rem;
  align-items: start;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--hb-border);
  border-radius: 14px;
  cursor: pointer;
  background: #fbfdff;
}

.hb-option input {
  margin-top: 0.25rem;
}

.hb-option:hover {
  border-color: var(--hb-border-strong);
}

.hb-answer-row {
  margin-top: 0.4rem;
}

.hb-answer-label {
  display: grid;
  gap: 0.4rem;
  font-weight: 700;
}

.hb-input {
  max-width: 240px;
  width: 100%;
  border: 1px solid var(--hb-border-strong);
  border-radius: 12px;
  padding: 0.75rem 0.8rem;
  font: inherit;
}

.hb-quiz-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.hb-hint,
.hb-feedback {
  margin-top: 0.85rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
}

.hb-hint {
  background: #f8fafc;
  border: 1px dashed var(--hb-border-strong);
  color: var(--hb-muted);
}

.hb-feedback {
  border: 1px solid var(--hb-border);
}

.hb-feedback.is-success {
  background: var(--hb-good-soft);
  border-color: rgba(15, 118, 110, 0.25);
  color: #0f3d39;
}

.hb-feedback.is-error {
  background: var(--hb-warn-soft);
  border-color: rgba(154, 52, 18, 0.2);
  color: #5e2b12;
}

.hb-feedback__explanation {
  margin-top: 0.45rem;
}

.hb-code {
  margin: 1rem 0 0;
  overflow-x: auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.55;
}

.hb-simulator {
  padding: 1.1rem;
  margin-bottom: 1rem;
}

.hb-simulator__grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 1rem;
}

.hb-simulator__controls,
.hb-simulator__metrics {
  display: grid;
  gap: 0.85rem;
}

.hb-control {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem;
  border: 1px solid var(--hb-border);
  border-radius: 14px;
  background: #fbfdff;
}

.hb-control span {
  color: var(--hb-muted);
  font-size: 0.95rem;
}

.hb-control strong {
  font-size: 1.08rem;
}

.hb-control input[type="range"] {
  width: 100%;
}

.hb-metric-card {
  padding: 0.9rem;
  border: 1px solid var(--hb-border);
  border-radius: 14px;
  background: #fbfdff;
}

.hb-metric-card__label {
  color: var(--hb-muted);
  font-size: 0.95rem;
}

.hb-metric-card__value {
  margin-top: 0.3rem;
  font-size: 1.35rem;
  font-weight: 800;
}

.hb-meter {
  margin-top: 0.7rem;
  height: 12px;
  background: #eef2f7;
  border-radius: 999px;
  overflow: hidden;
}

.hb-meter__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa 0%, #22c55e 100%);
}

.hb-review-summary {
  margin-bottom: 1rem;
  font-weight: 800;
}

.hb-review-table {
  display: grid;
  gap: 1rem;
}

.hb-review-block {
  padding: 1rem;
}

.hb-review-block h3 {
  margin-top: 0;
}

.hb-chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.25rem 0 0;
  flex-wrap: wrap;
}

.hb-chapter-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--hb-border-strong);
  background: var(--hb-panel);
  color: var(--hb-text);
  font-weight: 700;
}

.hb-chapter-nav__link:hover {
  text-decoration: none;
}

.hb-footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  color: var(--hb-muted);
}

.hb-footer__title {
  font-weight: 800;
  color: var(--hb-text);
}

@media (max-width: 1024px) {
  .hb-page-shell {
    grid-template-columns: 1fr;
  }

  .hb-sidebar {
    position: static;
  }

  .hb-hero-card {
    grid-template-columns: 1fr;
  }

  .hb-simulator__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hb-topbar {
    position: static;
    padding: 0.9rem 1rem;
  }

  .hb-breadcrumb,
  .hb-page-shell,
  .hb-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hb-page-shell {
    padding-top: 1rem;
  }

  .hb-course-nav__item {
    grid-template-columns: auto 1fr;
  }

  .hb-course-nav__count {
    grid-column: 2 / 3;
  }

  .hb-quiz-card__header {
    flex-direction: column;
  }

  .hb-table,
  .hb-table thead,
  .hb-table tbody,
  .hb-table tr,
  .hb-table th,
  .hb-table td {
    display: block;
    width: 100%;
  }

  .hb-table thead {
    display: none;
  }

  .hb-table tr {
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--hb-border);
  }

  .hb-table th,
  .hb-table td {
    border-bottom: none;
    padding-left: 0;
    padding-right: 0;
  }
}
