:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-alt: #efede6;
  --surface-subtle: #f2f0e9;
  --ink: #111615;
  --ink-secondary: #2b3330;
  --muted: #525d59;
  --rule: #cfd5d1;
  --rule-strong: #9aa59f;
  --accent: #0a5c46;
  --accent-strong: #064232;
  --accent-soft: #dff0ea;
  --accent-border: #8ec5b4;
  --warn-soft: #f9efe1;
  --warn-border: #d8a35d;
  --warn-ink: #5e3b09;
  --code-bg: #121917;
  --code-header: #1b2522;
  --code-ink: #e8f1ee;
  --code-muted: #9db0aa;
  --code-border: #2c3b36;
  --shadow: 0 1px 2px rgba(17, 22, 21, 0.06);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  --sticky-h: 9.5rem;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1312;
  --surface: #151c1a;
  --surface-alt: #1c2623;
  --surface-subtle: #18211f;
  --ink: #eef3f1;
  --ink-secondary: #d2dcd8;
  --muted: #98a8a2;
  --rule: #2a3733;
  --rule-strong: #465a54;
  --accent: #4fd1ab;
  --accent-strong: #7be0c2;
  --accent-soft: #13332a;
  --accent-border: #286855;
  --warn-soft: #292013;
  --warn-border: #8b6226;
  --warn-ink: #f3d39c;
  --code-bg: #090d0c;
  --code-header: #111816;
  --code-ink: #ecf4f1;
  --code-muted: #8fa59e;
  --code-border: #263530;
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.03rem;
  line-height: 1.62;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

a:hover {
  color: var(--accent-strong);
}

.skip {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  transform: translateY(-200%);
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--accent);
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  z-index: 50;
}

.skip:focus {
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.top-inner,
.sticky-inner,
.english,
.learn,
.rates,
.page-footer,
.noscript {
  width: min(100% - 2rem, 74rem);
  margin-inline: auto;
}

/* Header */
.top {
  background: var(--surface);
  border-top: 4px solid var(--accent);
  border-bottom: 1px solid var(--rule);
}

.top-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1.5rem;
  padding: 1.15rem 0 1rem;
}

.top-brand {
  max-width: 52rem;
}

.kicker {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.kicker-short {
  display: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.4vw, 2.45rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.persist {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.theme-btn:hover {
  border-color: var(--accent);
}

.theme-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--rule-strong);
}

[data-theme="dark"] .theme-dot {
  background: var(--accent);
}

/* Sticky Planning & View Bar */
.sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 2px solid var(--rule);
  box-shadow: var(--shadow);
}

.sticky-inner {
  padding: 0.65rem 0 0.65rem;
}

.sticky-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.sticky-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.plan-toggle {
  display: none;
  align-items: center;
  min-height: 2.1rem;
  padding: 0 0.7rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.plan-toggle[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.sheet-head,
.sheet-backdrop,
.pw-short,
.pw-tiny,
.rates-short {
  display: none;
}

.week-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.9rem;
}

.path-week {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}

.path-week strong {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.hire-line {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 500;
}

.views {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 2px;
  gap: 2px;
}

.views button {
  min-height: 2.3rem;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-secondary);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.views button[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .views button[aria-pressed="true"] {
  color: #081410;
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 1.35rem;
}

fieldset.ctrl-group {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.ctrl-group legend {
  padding: 0;
  margin-bottom: 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.choices {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.choices button {
  min-height: 2.15rem;
  padding: 0 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.choices button:hover {
  border-color: var(--accent);
}

.choices button[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.custom-hours {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
}

.custom-hours input {
  width: 4.6rem;
  min-height: 2.15rem;
  padding: 0 0.5rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.custom-hours input[aria-invalid="true"] {
  border-color: #c93b2b;
}

.phase-weeks {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(4.2rem, auto));
  gap: 0.35rem 0.9rem;
  margin: 0;
  padding: 0;
}

.phase-weeks li {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 3px;
}

.phase-weeks span {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.phase-weeks strong {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tempo-line {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.english {
  margin-top: 0.75rem;
  margin-bottom: 0;
  padding: 0.55rem 0.85rem;
  background: var(--surface-subtle);
  border-left: 3px solid var(--rule-strong);
  color: var(--ink-secondary);
  font-size: 0.9rem;
}

/* Main Layout */
main {
  padding-top: 1rem;
  padding-bottom: 2rem;
}

.learn,
.spine-col,
.reading,
#spine,
.rates {
  min-width: 0;
}

/* Spine Navigation */
.spine-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 2.15rem;
  padding: 0 0.65rem;
  border: 1px solid var(--accent-border);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  flex-shrink: 0;
}

.spine-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.spine-toggle[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.spine-toggle-icon {
  flex: none;
  color: var(--accent);
}

#spine {
  padding: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.spine-progress {
  margin: 0 0 0.65rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--rule);
}

.spine-count {
  margin: 0 0 0.3rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: var(--surface-alt);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.spine-label {
  margin: 0.8rem 0 0.25rem;
  padding-left: 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.concept-btn {
  display: grid;
  grid-template-columns: 0.95rem minmax(0, 1fr);
  gap: 0.55rem;
  align-items: start;
  width: 100%;
  margin: 1px 0;
  padding: 0.45rem 0.5rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.concept-btn:hover {
  background: var(--surface-alt);
}

.concept-btn .mark {
  width: 0.85rem;
  height: 0.85rem;
  margin-top: 0.22rem;
  border-radius: 2px;
  border: 1.5px solid var(--rule-strong);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  line-height: 1;
  color: transparent;
}

.concept-btn.is-map .mark {
  border-radius: 50%;
}

.concept-btn.is-done .mark {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

[data-theme="dark"] .concept-btn.is-done .mark {
  color: #081410;
}

.concept-btn.is-done .mark::before {
  content: "✓";
  font-weight: 700;
}

.concept-btn[aria-current="true"] {
  background: var(--accent-soft);
}

.concept-btn[aria-current="true"] .name {
  color: var(--accent);
  font-weight: 700;
}

.concept-btn .name {
  display: block;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.3;
}

.concept-btn .note {
  display: block;
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.75rem;
}

/* Reading Area (Textbook Chapter Card) */
.reading {
  margin-top: 0.85rem;
  padding: 1.5rem 1.35rem 1.8rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.chapter-head {
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--rule);
}

.chapter-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.chapter-tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 3px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chapter-hours {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.reading h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.3rem);
  line-height: 1.15;
}

.chapter-summary {
  margin: 0.6rem 0 0;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink-secondary);
  font-weight: 500;
}

.reading p {
  margin: 0 0 0.95rem;
}

.section-heading {
  margin: 1.85rem 0 0.65rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

.knowledge-prose p {
  max-width: 68ch;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 0.12rem 0.35rem;
  background: var(--surface-alt);
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Public Data Example Card */
.example-card {
  max-width: 100%;
  margin: 1.25rem 0 1.5rem;
  border: 1px solid var(--code-border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--code-bg);
  color: var(--code-ink);
}

.example-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.55rem 0.95rem;
  background: var(--code-header);
  border-bottom: 1px solid var(--code-border);
  font-size: 0.8rem;
}

.example-title {
  font-weight: 600;
  color: #ffffff;
}

.example-dataset {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--code-muted);
}

pre.example {
  margin: 0;
  padding: 0.95rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.52;
  color: var(--code-ink);
}

.example-explain {
  margin: 0;
  padding: 0.65rem 0.95rem;
  background: var(--code-header);
  border-top: 1px solid var(--code-border);
  font-size: 0.88rem;
  color: #d5e3de;
}

.example-explain code {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* Expandable Deep-Dive / Pitfalls */
.deep-dives {
  display: grid;
  gap: 0.65rem;
  margin: 1.1rem 0 1.4rem;
}

details.deep-dive {
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: var(--surface-subtle);
}

details.deep-dive summary {
  padding: 0.7rem 0.95rem;
  font-weight: 600;
  font-size: 0.96rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

details.deep-dive summary::-webkit-details-marker {
  display: none;
}

details.deep-dive summary::after {
  content: "Expand +";
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--accent);
  flex: none;
}

details.deep-dive[open] summary {
  border-bottom: 1px solid var(--rule);
  background: var(--surface-alt);
}

details.deep-dive[open] summary::after {
  content: "Collapse −";
}

.deep-dive-body {
  padding: 0.85rem 0.95rem 0.9rem;
  font-size: 0.95rem;
}

.deep-dive-body p:last-child {
  margin-bottom: 0;
}

/* Subconcepts Grid */
.subs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 0.85rem;
  margin-top: 0.6rem;
}

.sub {
  padding: 0.95rem 1rem;
  background: var(--surface-subtle);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 3px;
}

.sub h3 {
  margin: 0 0 0.4rem;
  font-size: 1.12rem;
  line-height: 1.25;
}

.sub p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--ink-secondary);
}

/* Community Recommended Exercise Box */
.exercise-box {
  margin-top: 1.5rem;
  padding: 1.05rem 1.15rem;
  background: var(--surface-subtle);
  border: 1px solid var(--accent-border);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
}

.exercise-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
}

.exercise-title {
  margin: 0 0 0.35rem;
  font-family: var(--serif);
  font-size: 1.22rem;
}

.exercise-source {
  margin: 0 0 0.45rem !important;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
}

.exercise-desc {
  margin: 0 0 0.65rem !important;
  font-size: 0.95rem;
}

.exercise-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.8rem;
  background: var(--accent);
  color: #ffffff !important;
  text-decoration: none;
  border-radius: 3px;
  font-size: 0.88rem;
  font-weight: 600;
}

[data-theme="dark"] .exercise-link {
  color: #081410 !important;
}

.exercise-link:hover {
  background: var(--accent-strong);
}

/* Deliverable & Check */
.deliver {
  margin-top: 1.4rem;
  padding: 0.95rem 1.1rem;
  background: var(--warn-soft);
  border: 1px solid var(--warn-border);
  border-left: 4px solid var(--warn-border);
  border-radius: 4px;
}

h3.deliver-label {
  margin: 0 0 0.3rem;
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warn-ink);
}

.deliver p {
  margin: 0;
  font-size: 0.96rem;
  color: var(--ink);
}

.check {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-top: 1.35rem;
  padding: 0.9rem 1.05rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.check input {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.nav-step-btn {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--surface-alt);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.nav-step-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Map Flow & Phases */
.flow,
.phase-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.flow li {
  margin: 0 0 0.8rem;
}

.flow-row {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr) auto;
  gap: 0.15rem 0.7rem;
  align-items: baseline;
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--rule);
  border-radius: 4px 4px 0 0;
  background: var(--surface-subtle);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

button.flow-row {
  cursor: pointer;
}

button.flow-row:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.flow-row .idx {
  grid-row: 1 / span 2;
  align-self: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.flow-row .name {
  font-family: var(--serif);
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.25;
}

.flow-row .gloss {
  grid-column: 2 / -1;
  color: var(--ink-secondary);
  font-size: 0.93rem;
}

.track-count {
  grid-row: 1;
  grid-column: 3;
  justify-self: end;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.track-chapters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.55rem 0.8rem 0.6rem;
  border: 1px solid var(--rule);
  border-top: 0;
  border-radius: 0 0 4px 4px;
  background: var(--surface);
}

.chip {
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.chip.is-done {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.chip.is-current {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
  text-decoration: none;
}

.phase-block {
  margin-top: 1.8rem;
}

.phase-block h3 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
}

.phase-list li {
  display: grid;
  grid-template-columns: 4.5rem 3.2rem minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
}

.ph-name {
  font-weight: 700;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.ph-week {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ph-desc {
  color: var(--ink-secondary);
  font-size: 0.95rem;
}

/* Rates View */
.rates {
  margin-top: 0.85rem;
  padding: 1.5rem 1.35rem 1.8rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: var(--shadow);
  max-width: 54rem;
}

.rates h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.15;
}

.rates h3 {
  margin: 1.5rem 0 0.25rem;
  font-size: 1.35rem;
}

.rates p {
  margin: 0 0 0.8rem;
}

.source {
  color: var(--muted);
  font-size: 0.92rem;
}

.calc-strip {
  margin: 1.15rem 0 1.4rem;
  padding: 0.95rem 1.1rem;
  background: var(--surface-subtle);
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.calc-strip label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.calc-strip input {
  width: 7.5rem;
  min-height: 2.35rem;
  padding: 0 0.6rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
}

.calc-result {
  margin: 0 !important;
  font-size: 0.98rem;
}

.calc-result strong {
  font-family: var(--mono);
  font-size: 1.2rem;
  color: var(--accent);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.4rem 0 0.6rem;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: baseline;
}

thead th {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-subtle);
  border-top: 1px solid var(--rule);
}

tbody th {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
}

td.num {
  font-family: var(--mono);
  font-size: 0.95rem;
}

th.num,
td.num {
  text-align: right;
}

td.num .end {
  white-space: nowrap;
}

td.num .end + .end::before {
  content: "\00a0\2013\00a0";
}

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 1.9rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--rule);
}

.nav-step-btn {
  min-height: 2.5rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.nav-step-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

tr.has-aside th,
tr.has-aside td {
  border-bottom: 0;
  padding-bottom: 0.2rem;
}

tr.aside td {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.88rem;
  text-align: left;
  padding-top: 0.1rem;
  padding-bottom: 0.65rem;
}

.footnote {
  margin-top: 1.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}

.page-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 0.5rem;
  margin-bottom: 2.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--rule);
}

.footer-note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.text-btn {
  min-height: 2.4rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink-secondary);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.text-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#reading h2,
#rates h2 {
  scroll-margin-top: calc(var(--sticky-h) + 1rem);
}

@media (min-width: 720px) {
  .flow-row {
    grid-template-columns: 2.2rem 11.5rem minmax(0, 1fr) auto;
    gap: 0.4rem 0.85rem;
  }

  .flow-row .idx {
    grid-row: 1;
    align-self: baseline;
  }

  .flow-row .gloss {
    grid-column: 3;
  }

  .track-count {
    grid-column: 4;
  }

  .reading,
  .rates {
    padding: 2rem 2.25rem 2.2rem;
  }
}

@media (max-width: 640px) {
  .sticky .phase-weeks {
    display: none;
  }

  .phase-weeks {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.3rem;
  }

  .phase-weeks li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
    padding: 0.25rem 0.4rem;
  }

  th.num,
  td.num {
    text-align: left;
  }

  .rates table,
  .rates tbody,
  .rates tr,
  .rates th,
  .rates td {
    display: block;
    width: auto;
  }

  .rates thead {
    display: none;
  }

  .rates tr {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--rule);
  }

  .rates th,
  .rates td {
    border: 0;
    padding: 0.1rem 0;
  }

  .rates tbody th {
    font-size: 1rem;
  }

  .rates td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-family: var(--sans);
    font-size: 0.76rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .rates td.num {
    text-align: left;
  }

  .rates td.num .end {
    display: inline;
  }

  .rates td.num .end + .end::before {
    content: "\2013";
  }

  .chapter-nav {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 920px) {
  .top-inner,
  .sticky-inner,
  .english,
  .learn,
  .rates,
  .page-footer,
  .noscript {
    width: min(100% - 3.5rem, 74rem);
  }

  .spine-toggle {
    display: none;
  }

  #spine {
    display: block;
    margin-top: 0;
    max-height: calc(100vh - var(--sticky-h) - 1.5rem);
    overflow-y: auto;
  }

  .reading {
    margin-top: 0;
  }

  .learn {
    display: grid;
    grid-template-columns: 17.5rem minmax(0, 1fr);
    column-gap: 2rem;
    align-items: start;
  }

  .learn.is-rates {
    display: none;
  }

  .spine-col {
    position: sticky;
    top: calc(var(--sticky-h) + 0.75rem);
    align-self: start;
  }
}

/* Phone and tablet: compact sticky bar with left hamburger button + slide-out left drawer */
@media (max-width: 919px) {
  .sticky.is-plan-open {
    z-index: 40;
  }

  .sticky-inner {
    padding: 0.4rem 0;
  }

  .sticky-top {
    flex-wrap: nowrap;
    gap: 0.4rem;
  }

  .spine-toggle {
    max-width: 15.5rem;
    min-width: 0;
  }

  .spine-toggle-kicker {
    font-weight: 700;
  }

  .spine-toggle-now {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding-left: 0.38rem;
    border-left: 1px solid var(--rule);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--muted);
  }

  .week-summary {
    flex-wrap: nowrap;
    flex-shrink: 0;
    gap: 0 0.35rem;
    min-width: 0;
  }

  .path-week {
    font-size: 0.88rem;
    white-space: nowrap;
  }

  .path-week strong {
    font-size: 1.22rem;
  }

  .pw-full,
  .rates-full,
  .hire-line {
    display: none;
  }

  .pw-short,
  .rates-short {
    display: inline;
  }

  .sticky-tools {
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .views button {
    min-height: 2.15rem;
    padding: 0 0.62rem;
    font-size: 0.82rem;
  }

  .plan-toggle {
    display: inline-flex;
    min-height: 2.15rem;
    padding: 0 0.62rem;
    font-size: 0.82rem;
  }

  .spine-col {
    margin: 0;
  }

  .sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(6, 18, 14, 0.52);
    z-index: 35;
  }

  .sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.6rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--rule);
  }

  .sheet-title {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
  }

  .sheet-close {
    min-height: 2.15rem;
    padding: 0 0.75rem;
    border: 1px solid var(--rule-strong);
    border-radius: 3px;
    background: var(--surface-alt);
    color: var(--ink);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
  }

  .sheet-close:hover {
    border-color: var(--accent);
    color: var(--accent);
  }

  #plan-panel {
    display: none;
  }

  .sticky.is-plan-open #plan-panel {
    display: block;
    position: fixed;
    left: max(0.6rem, env(safe-area-inset-left));
    right: max(0.6rem, env(safe-area-inset-right));
    top: var(--sheet-top, 4.2rem);
    max-height: calc(100dvh - var(--sheet-top, 4.2rem) - 1rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.85rem 0.9rem calc(0.9rem + env(safe-area-inset-bottom));
    background: var(--surface);
    border: 1px solid var(--rule-strong);
    border-radius: 6px;
    box-shadow: 0 18px 40px rgba(8, 20, 16, 0.28);
    z-index: 41;
  }

  #plan-panel .controls-bar {
    flex-direction: column;
    align-items: stretch;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  #plan-panel .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.7rem;
  }

  #plan-panel .phase-weeks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    margin-top: 0.2rem;
  }

  #plan-panel .phase-weeks li {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.32rem 0.6rem;
  }

  #spine {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(19.5rem, 86vw);
    max-width: 100%;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0 0.85rem max(1rem, env(safe-area-inset-bottom)) max(0.85rem, env(safe-area-inset-left));
    background: var(--surface);
    border: 0;
    border-right: 1px solid var(--rule-strong);
    border-radius: 0;
    box-shadow: 14px 0 38px rgba(8, 20, 16, 0.32);
    z-index: 40;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.22s;
  }

  #spine.is-open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
  }

  #spine .sheet-head {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 -0.85rem 0.65rem calc(-1 * max(0.85rem, env(safe-area-inset-left)));
    padding: max(0.75rem, env(safe-area-inset-top)) 0.85rem 0.6rem max(0.85rem, env(safe-area-inset-left));
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
  }

  #spine .concept-btn {
    min-height: 2.35rem;
    align-items: center;
    padding: 0.45rem 0.55rem;
  }

  #spine .concept-btn .mark {
    margin-top: 0;
  }

  body.is-sheet-open {
    overflow: hidden;
  }

  .reading,
  .rates {
    margin-top: 0.5rem;
  }

  .reading h2,
  .rates h2 {
    font-size: clamp(1.5rem, 6.5vw, 2rem);
  }

  .chapter-summary {
    font-size: 1.02rem;
    line-height: 1.5;
  }
}

@media (max-width: 640px) {
  .spine-toggle-now {
    display: none;
  }

  .top-inner {
    gap: 0.55rem 1rem;
    padding: 0.8rem 0 0.75rem;
  }

  .top-brand {
    max-width: none;
  }

  .kicker {
    margin-bottom: 0.15rem;
    font-size: 0.7rem;
    letter-spacing: 0.07em;
  }

  .kicker-full {
    display: none;
  }

  .kicker-short {
    display: inline;
  }

  h1 {
    font-size: 1.66rem;
  }

  .persist {
    margin-top: 0.25rem;
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .theme-btn {
    min-height: 2.05rem;
    padding: 0.25rem 0.6rem;
    gap: 0.4rem;
    font-size: 0.78rem;
  }

  .reading,
  .rates {
    padding: 1.1rem 1rem 1.3rem;
  }

  .chapter-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .nav-step-btn {
    width: 100%;
    text-align: center;
  }

  .example-head {
    padding: 0.5rem 0.7rem;
  }

  pre.example {
    padding: 0.8rem;
    font-size: 0.78rem;
  }

  .chip {
    min-height: 2.1rem;
    padding: 0.4rem 0.7rem;
  }

  .flow-row {
    padding: 0.6rem 0.7rem;
  }

  .phase-list li {
    grid-template-columns: 3.6rem 2.4rem minmax(0, 1fr);
  }

  .custom-hours input,
  .calc-strip input {
    font-size: 1rem;
  }
}

@media (max-width: 440px) {
  .pw-short {
    display: none;
  }

  .pw-tiny {
    display: inline;
  }
}

@media (max-width: 365px) {
  .top-inner,
  .sticky-inner,
  .english,
  .learn,
  .rates,
  .page-footer,
  .noscript {
    width: calc(100% - 1.25rem);
  }

  .sticky-top {
    gap: 0.25rem;
  }

  .spine-toggle {
    padding: 0 0.45rem;
    gap: 0.28rem;
    font-size: 0.79rem;
  }

  .path-week {
    font-size: 0.79rem;
  }

  .path-week strong {
    font-size: 1.05rem;
  }

  .plan-toggle,
  .views button {
    padding: 0 0.45rem;
    font-size: 0.77rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  #spine,
  #spine.is-open {
    transition: none;
  }
}
