/*
  Your Brain on Love: a study guide.
  Look: white pages, near-black text, one coral accent taken from the illustration,
  soft rounded cards and a single quiet shadow (after the Airbnb design notes).
  Shapes follow one rule: buttons and fields 8px, cards 14px, feature panels 20px,
  chips and counters fully round.
  Pages run the full width of the screen with padding only; text keeps a readable measure.
*/

:root {
  --canvas: #ffffff;
  --soft: #f7f7f7;
  --soft-2: #f2f2f2;
  --ink: #222222;
  --body: #3f3f3f;
  --muted: #6a6a6a;
  --line: #dddddd;
  --line-soft: #ebebeb;
  --line-strong: #c1c1c1;
  /* The accent: decorative coral, and a deeper one that carries white text and links. */
  --coral: #ef6b4a;
  --coral-ink: #c5341f;
  --coral-press: #a52a17;
  --coral-soft: #fdefea;
  --coral-line: #f6cdc2;
  /* The three attachment patterns keep a tint of their own, from the same illustration. */
  --island: #fbf1dc;
  --island-ink: #7a5710;
  --wave: #e1f3f3;
  --wave-ink: #0d6769;
  --anchor: #e8edf3;
  --anchor-ink: #17324d;
  --good: #e7f5ec;
  --good-ink: #0b6b3a;
  --retry: #fff4e3;
  --retry-ink: #8a4a00;
  --shadow: rgba(0, 0, 0, 0.02) 0 0 0 1px, rgba(0, 0, 0, 0.04) 0 2px 6px 0, rgba(0, 0, 0, 0.1) 0 4px 8px 0;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --font: "Figtree", "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(16px, 4vw, 72px);
  --bar: 72px;
  --measure: 70ch;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--bar) + 20px);
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--body);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
img {
  max-width: 100%;
  height: auto;
}
a {
  color: var(--coral-ink);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
a:hover {
  color: var(--coral-press);
}
a,
button,
summary,
label {
  touch-action: manipulation;
}
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 4px;
}
::selection {
  background: #fbd9cf;
}
[id] {
  scroll-margin-top: calc(var(--bar) + 20px);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 60;
  transform: translateY(-220%);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus-visible {
  transform: none;
  color: #fff;
}

/* ---------- Type ---------- */
h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}
h1 {
  font-size: clamp(34px, 3.3vw, 54px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.028em;
}
h2 {
  font-size: clamp(24px, 1.9vw, 30px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.018em;
}
h3 {
  margin-top: 28px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
h4 {
  margin-top: 20px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}
p {
  margin: 14px 0 0;
  text-wrap: pretty;
}
ul,
ol {
  margin: 14px 0 0;
  padding-left: 22px;
}
li {
  margin-top: 6px;
}
li::marker {
  color: var(--muted);
}
strong {
  color: var(--ink);
  font-weight: 600;
}
hr {
  height: 1px;
  margin: 40px 0;
  border: 0;
  background: var(--line-soft);
}
.lede {
  margin-top: 16px;
  max-width: 62ch;
  font-size: clamp(18px, 1.3vw, 21px);
  line-height: 1.55;
  color: var(--body);
}
.eyebrow {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--coral-ink);
}
.muted {
  color: var(--muted);
}
.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- Buttons, chips ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--coral-ink);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.12s var(--ease);
}
.btn:hover {
  background: var(--coral-press);
  color: #fff;
}
.btn:active {
  transform: scale(0.98);
}
.btn[disabled] {
  background: #f3c7be;
  cursor: not-allowed;
}
.btn-secondary {
  border-color: var(--ink);
  background: var(--canvas);
  color: var(--ink);
}
.btn-secondary:hover {
  background: var(--soft);
  color: var(--ink);
}
.btn-quiet {
  min-height: 40px;
  padding: 8px 12px;
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}
.btn-quiet:hover {
  background: transparent;
  color: var(--ink);
  text-decoration-color: currentColor;
}
.btn-sm {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 15px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--soft-2);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-coral {
  background: var(--coral-soft);
  color: var(--coral-ink);
}
.chip-good {
  background: var(--good);
  color: var(--good-ink);
}
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--coral-ink);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--soft-2);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
  transform-origin: left;
  transition: width 0.6s var(--ease);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--bar);
  padding: 0 max(var(--pad), env(safe-area-inset-right)) 0 max(var(--pad), env(safe-area-inset-left));
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.6) blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover {
  color: var(--ink);
}
.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--coral);
}
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.topnav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 15.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.topnav a:hover {
  background: var(--soft);
  color: var(--ink);
}
.topnav a[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--ink);
  border-radius: 0;
}
.bar-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.bar-progress .meter {
  width: 96px;
}
.menu-toggle {
  display: none;
}

/* ---------- Page frames ---------- */
.page {
  padding: 48px var(--pad) 96px;
}
.page-head {
  max-width: 70ch;
}
.shell {
  display: grid;
  grid-template-columns: minmax(232px, 288px) minmax(0, 1fr) minmax(264px, 344px);
  align-items: start;
  gap: clamp(24px, 3.2vw, 64px);
  padding: 0 var(--pad) 96px;
}
.outline,
.rail {
  position: sticky;
  top: calc(var(--bar) + 28px);
  max-height: calc(100dvh - var(--bar) - 56px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-bottom: 8px;
}
.outline {
  padding-top: 28px;
}
.rail {
  padding-top: 28px;
}
.lesson {
  min-width: 0;
  padding-top: 40px;
}

/* ---------- Course outline (left) ---------- */
.outline ol + .outline-title {
  margin-top: 22px;
}
.outline-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.outline ol {
  margin: 0;
  padding: 0;
  list-style: none;
}
.outline li {
  margin: 0;
}
.outline-link {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--body);
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 0.15s;
}
.outline-link:hover {
  background: var(--soft);
  color: var(--ink);
}
.outline-link[aria-current="page"] {
  background: var(--soft);
  color: var(--ink);
  font-weight: 600;
}
.outline-link small {
  display: block;
  margin-top: 1px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}
.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.step[data-state="done"] {
  border-color: var(--good-ink);
  background: var(--good-ink);
  color: #fff;
}
.step[data-state="current"] {
  border-color: var(--coral-ink);
  color: var(--coral-ink);
}
.outline-sections {
  margin: 4px 0 8px 38px !important;
  padding: 0 0 0 14px !important;
  border-left: 1px solid var(--line-soft);
}
.outline-sections a {
  display: block;
  padding: 5px 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  text-decoration: none;
}
.outline-sections a:hover {
  color: var(--ink);
}
.outline-sections a[aria-current="true"] {
  color: var(--ink);
  font-weight: 600;
}
.outline-extra {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- Right rail ---------- */
.rail-block + .rail-block {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line-soft);
}
.rail-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.rail-note {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.term-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.term-list li {
  margin: 0;
  border-top: 1px solid var(--line-soft);
}
.term-list li:first-child {
  border-top: 0;
}
.term-list details {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
}
.term-list summary {
  padding: 9px 22px 9px 0;
  font-size: 14.5px;
  font-weight: 600;
}
.term-list .details-body {
  padding: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--body);
}
textarea,
input[type="text"],
input[type="search"] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--canvas);
  color: var(--ink);
  font: inherit;
  font-size: 15.5px;
  line-height: 1.5;
}
textarea {
  min-height: 132px;
  resize: vertical;
}
textarea::placeholder,
input::placeholder {
  color: var(--muted);
}
textarea:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
}
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.save-status {
  min-height: 20px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Lesson header ---------- */
.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 14px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
}
.lesson-meta .meter {
  width: 140px;
}
.lesson > h1,
.lesson-head h1 {
  max-width: 22ch;
}
.objectives {
  margin-top: 28px;
  padding: 24px 28px;
  border-radius: var(--r-lg);
  background: var(--soft);
}
.objectives h2 {
  font-size: 18px;
  letter-spacing: -0.01em;
}
.objectives ul {
  margin-top: 10px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.objectives li {
  position: relative;
  margin: 0;
  padding-left: 30px;
  color: var(--ink);
}
.objectives li::before,
.tick::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.42em;
  width: 13px;
  height: 7px;
  border-left: 2px solid var(--coral-ink);
  border-bottom: 2px solid var(--coral-ink);
  transform: rotate(-45deg);
}
.big-idea {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 16px;
  color: var(--body);
}

/* ---------- Lesson sections ---------- */
.lsec {
  margin-top: 56px;
}
.lsec-main > *:first-child {
  margin-top: 0;
}
.lsec-main > p,
.lsec-main > ul,
.lsec-main > ol,
.lsec-main > h3,
.lsec-main > h4,
.lsec-main > blockquote,
.lsec-main > details,
.lsec-main > .science-note,
.lesson > p,
.lesson > ul,
.lesson > blockquote,
.prose > p,
.prose > ul,
.prose > ol,
.prose > h2,
.prose > h3,
.prose > blockquote,
.prose > details {
  max-width: var(--measure);
}
.lsec-aside {
  margin-top: 24px;
  display: grid;
  gap: 16px;
  align-content: start;
  max-width: var(--measure);
}
.simple {
  margin: 14px 0 0;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--coral-soft);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}
.simple strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13.5px;
  color: var(--coral-ink);
}
blockquote {
  margin: 22px 0 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--coral);
  color: var(--ink);
  font-size: 19px;
  line-height: 1.5;
}
blockquote p:first-child {
  margin-top: 0;
}
details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--canvas);
}
summary {
  position: relative;
  padding: 14px 44px 14px 18px;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker {
  display: none;
}
summary::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s var(--ease);
}
details[open] > summary::after {
  transform: rotate(225deg);
  margin-top: -2px;
}
summary small {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.details-body {
  padding: 0 18px 18px;
}
.details-body > *:first-child {
  margin-top: 0;
}
.panel,
.science-note {
  margin-top: 18px;
  padding: 20px 22px;
  border-radius: var(--r-md);
  background: var(--soft);
}
.panel > *:first-child,
.science-note > *:first-child {
  margin-top: 0;
}
.science-note {
  border: 1px solid var(--line-soft);
  background: var(--canvas);
  font-size: 15.5px;
  color: var(--muted);
}
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  margin-top: 18px;
}
.two-col .panel {
  margin-top: 0;
}
.term {
  border-bottom: 1px dashed var(--coral);
  color: inherit;
  cursor: help;
}
.term:hover,
.term:focus-visible {
  background: var(--coral-soft);
}

/* Comparison table: the three patterns side by side. */
.table-wrap {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.compare {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 15.5px;
  line-height: 1.5;
}
.compare th,
.compare td {
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line-soft);
}
.compare thead th {
  border-top: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}
.compare thead th:nth-child(2) {
  background: var(--island);
  color: var(--island-ink);
}
.compare thead th:nth-child(3) {
  background: var(--wave);
  color: var(--wave-ink);
}
.compare thead th:nth-child(4) {
  background: var(--anchor);
  color: var(--anchor-ink);
}
.compare tbody td:first-child {
  width: 16%;
  color: var(--ink);
  font-weight: 600;
}

/* The three patterns as profile blocks. */
.style-block {
  margin-top: 56px;
  padding: clamp(22px, 2.4vw, 36px);
  border-radius: var(--r-lg);
  background: var(--soft);
}
.style-block#island {
  background: var(--island);
}
.style-block#wave {
  background: var(--wave);
}
.style-block#anchor {
  background: var(--anchor);
}
.style-block > * {
  max-width: var(--measure);
}
.style-block details {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.08);
}
.style-art {
  float: right;
  width: clamp(96px, 12vw, 168px);
  height: auto;
  margin: 0 0 12px 20px;
  border-radius: var(--r-md);
}
.style-name-large {
  margin-top: 4px;
  font-size: clamp(30px, 2.6vw, 40px);
}
.style-block .eyebrow {
  color: var(--ink);
}

/* Window of tolerance. */
.wot {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  max-width: var(--measure);
}
.wot-band {
  padding: 16px 20px;
  border-radius: var(--r-md);
  font-size: 15.5px;
  line-height: 1.45;
}
.wot-high {
  background: var(--coral-soft);
  color: var(--coral-press);
}
.wot-mid {
  background: var(--good);
  color: var(--good-ink);
}
.wot-low {
  background: var(--anchor);
  color: var(--anchor-ink);
}
.wot-label {
  display: block;
  font-weight: 700;
}
.flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.flow span {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--soft-2);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
}
.flow i {
  width: 14px;
  height: 2px;
  background: var(--line-strong);
}

/* Illustration. */
.concept-hero {
  margin: 28px 0 0;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #fdf3df;
}
.concept-hero img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  object-fit: cover;
}
.concept-hero figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  padding: 14px 20px;
  background: var(--soft);
  color: var(--body);
  font-size: 15px;
}
.concept-hero figcaption span {
  flex: 1 1 180px;
}

/* ---------- Learning blocks ---------- */
.block {
  padding: clamp(20px, 2vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--canvas);
}
.block > *:first-child {
  margin-top: 0;
}
.block h2,
.block h3 {
  margin-top: 6px;
  font-size: 20px;
  letter-spacing: -0.01em;
}
.block-kicker {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--coral-ink);
}
.scenario {
  border: 0;
  background: var(--soft);
}
.options {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.options li {
  margin: 0;
}
.option {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--canvas);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.12s var(--ease);
}
.option:hover:not([disabled]) {
  border-color: var(--ink);
  background: var(--soft);
}
.option:active:not([disabled]) {
  transform: scale(0.995);
}
.option .key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--soft-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}
.option[data-state="right"] {
  border-color: var(--good-ink);
  background: var(--good);
}
.option[data-state="right"] .key {
  background: var(--good-ink);
  color: #fff;
}
.option[data-state="wrong"] {
  border-color: var(--retry-ink);
  background: var(--retry);
}
.option[data-state="wrong"] .key {
  background: var(--retry-ink);
  color: #fff;
}
.option[data-state="chosen"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.option[disabled] {
  cursor: default;
}
.feedback {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: var(--soft);
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--ink);
}
.feedback[data-tone="right"] {
  background: var(--good);
  color: var(--good-ink);
}
.feedback[data-tone="wrong"] {
  background: var(--retry);
  color: var(--retry-ink);
}
.feedback:empty {
  display: none;
}
.block-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

/* End of lesson. */
.finish {
  display: grid;
  gap: 20px;
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.finish-head h2 {
  font-size: clamp(26px, 2.2vw, 34px);
}
.finish-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 20px;
  align-items: start;
}
.recall-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.recall-progress .meter {
  flex: 1;
}
.score {
  font-size: clamp(40px, 4vw, 64px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.practice-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--ink);
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
}
.practice-check input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--coral-ink);
}
.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 16px;
  margin-top: 8px;
}
.pager a {
  display: block;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: box-shadow 0.25s var(--ease), border-color 0.2s;
}
.pager a:hover {
  border-color: transparent;
  box-shadow: var(--shadow);
}
.pager small {
  display: block;
  margin-bottom: 2px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}
.pager .next {
  text-align: right;
}

/* Flashcards. */
.flash {
  position: relative;
  display: block;
  width: 100%;
  min-height: 220px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  perspective: 1400px;
}
.flash-inner {
  position: relative;
  display: grid;
  min-height: 220px;
  transform-style: preserve-3d;
  transition: transform 0.55s var(--ease);
}
.flash[aria-pressed="true"] .flash-inner {
  transform: rotateY(180deg);
}
.flash-face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: clamp(22px, 3vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--canvas);
  backface-visibility: hidden;
  box-shadow: var(--shadow);
}
.flash-back {
  background: var(--soft);
  transform: rotateY(180deg);
}
.flash-face small {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--coral-ink);
}
.flash-face strong {
  font-size: clamp(20px, 1.8vw, 26px);
  line-height: 1.3;
  letter-spacing: -0.012em;
}
.flash-back span {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
}
.flash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

/* ---------- Home ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  align-items: end;
  gap: clamp(24px, 3.4vw, 64px);
  padding: clamp(32px, 4.5vw, 72px) var(--pad) clamp(32px, 4vw, 56px);
}
.hero h1 {
  max-width: 14ch;
  font-size: clamp(40px, 5vw, 84px);
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 28px;
}
.hero-side:empty {
  display: none;
}
.hero-art {
  grid-column: 1 / -1;
  margin: clamp(8px, 1vw, 16px) 0 0;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: #fdf3df;
}
.hero-art img {
  display: block;
  width: 100%;
  height: auto;
}
.hero-art figcaption {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 16px;
  padding: 14px clamp(16px, 2vw, 28px);
  background: var(--soft);
  color: var(--body);
  font-size: 15.5px;
}
.band {
  padding: clamp(40px, 5vw, 80px) var(--pad);
}
.band-soft {
  background: var(--soft);
}
.band-head {
  max-width: 62ch;
}
.band-head p {
  font-size: 18px;
}
.course {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
  align-items: start;
  gap: clamp(24px, 3.4vw, 64px);
  margin-top: 36px;
}
.path-parts {
  display: grid;
  gap: 40px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.path-part {
  margin: 0;
}
.path-part h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}
.path {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.path li {
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.path-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 20px;
  padding: 22px 8px;
  color: inherit;
  text-decoration: none;
  transition: background-color 0.2s;
}
.path-item:hover {
  background: var(--soft);
  color: inherit;
}
.path-item .step {
  width: 36px;
  height: 36px;
  font-size: 15px;
}
.path-title {
  display: block;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
}
.path-desc {
  display: block;
  margin-top: 3px;
  max-width: 62ch;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.45;
}
.path-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.today {
  position: sticky;
  top: calc(var(--bar) + 24px);
  display: grid;
  gap: 16px;
}
.today .block h2 {
  font-size: 19px;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.stat b {
  display: block;
  color: var(--ink);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.3;
}
.how {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 0 clamp(24px, 3vw, 56px);
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
}
.how li {
  margin: 0;
  padding: 22px 0 6px;
  border-top: 2px solid var(--ink);
}
.how b {
  display: block;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.how span {
  display: block;
  margin-top: 6px;
  color: var(--body);
  font-size: 16px;
  line-height: 1.5;
}
/* ---------- Practice, quiz, glossary ---------- */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  align-items: start;
  gap: clamp(24px, 3.4vw, 64px);
  margin-top: 36px;
}
.stack {
  display: grid;
  gap: 20px;
}
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 28px;
  padding: 4px;
  border-radius: 999px;
  background: var(--soft-2);
}
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.tabs a[aria-current="true"] {
  background: var(--canvas);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.empty {
  padding: clamp(24px, 3vw, 44px);
  border-radius: var(--r-lg);
  background: var(--soft);
}
.empty h2 {
  font-size: 22px;
}
.result-bars {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}
.result-bar {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.result-bar .meter {
  height: 10px;
}
.result-bar[data-style="I"] .meter > span {
  background: #d9a22b;
}
.result-bar[data-style="W"] .meter > span {
  background: #159a9c;
}
.result-bar[data-style="A"] .meter > span {
  background: #17324d;
}
.glossary {
  margin: 28px 0 0;
  padding: 0;
  columns: 3 340px;
  column-gap: clamp(24px, 3vw, 56px);
}
.glossary div {
  break-inside: avoid;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.glossary dt {
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
}
.glossary dd {
  margin: 4px 0 0;
  font-size: 15.5px;
  line-height: 1.5;
}
.search {
  max-width: 420px;
  margin-top: 24px;
}

/* Tooltip for glossary terms. */
.tooltip {
  position: absolute;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--canvas);
  box-shadow: var(--shadow);
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.2s var(--ease);
}
.tooltip[data-open="true"] {
  opacity: 1;
  transform: none;
}
.tooltip b {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  padding: 28px var(--pad) 40px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}
.footer p {
  margin: 0;
  max-width: 76ch;
}
.footer a {
  color: var(--ink);
}

/* ---------- Motion ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 0.6s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 70ms);
  }
  .feedback:not(:empty) {
    animation: rise 0.35s var(--ease) both;
  }
  @supports (animation-timeline: view()) {
    .reveal {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 45%;
    }
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn,
  .option,
  .flash-inner,
  .meter > span,
  .pager a {
    transition: none;
  }
}

/* On a very wide screen the type grows a little, so the reading column keeps its proportion. */
@media (min-width: 2100px) {
  body {
    font-size: 19px;
  }
  :root {
    --bar: 80px;
  }
}

/* ---------- Wide screens: notes beside the text ---------- */
@media (min-width: 1760px) {
  .lsec {
    display: grid;
    grid-template-columns: minmax(0, var(--measure)) minmax(300px, 440px);
    align-items: start;
    column-gap: clamp(32px, 3vw, 64px);
  }
  .lsec-aside {
    position: sticky;
    top: calc(var(--bar) + 28px);
    margin-top: 0;
  }
  .lsec[data-wide="true"] {
    display: block;
  }
  .lsec[data-wide="true"] .lsec-aside {
    position: static;
    margin-top: 24px;
  }
}

/* ---------- Narrower screens ---------- */
@media (max-width: 1240px) {
  .shell {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  }
  .outline {
    position: fixed;
    inset: var(--bar) auto 0 0;
    z-index: 35;
    width: min(88vw, 340px);
    max-height: none;
    padding: 24px 20px;
    background: var(--canvas);
    box-shadow: var(--shadow);
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform 0.3s var(--ease), visibility 0.3s;
  }
  body[data-menu="open"] .outline {
    transform: none;
    visibility: visible;
  }
  .scrim {
    position: fixed;
    inset: var(--bar) 0 0 0;
    z-index: 34;
    border: 0;
    background: rgba(0, 0, 0, 0.5);
  }
  .menu-toggle {
    display: inline-flex;
  }
}
@media (max-width: 900px) {
  body {
    font-size: 16.5px;
  }
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    position: static;
    max-height: none;
    padding-top: 0;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
  }
  .hero,
  .course,
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-art figcaption {
    grid-template-columns: minmax(0, 1fr);
  }
  .today {
    position: static;
  }
  .bar-progress {
    display: none;
  }
  .topbar {
    gap: 10px;
  }
  .path-item {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .path-meta {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
  }
}
@media (max-width: 560px) {
  :root {
    --bar: 64px;
  }
  .brand-name {
    display: none;
  }
  .brand-dot {
    width: 16px;
    height: 16px;
  }
  .topnav a {
    padding: 0 10px;
    font-size: 15px;
  }
  /* On a lesson the "Lessons" button already leads back to the course. */
  body[data-outline] .topnav a[href="index.html"] {
    display: none;
  }
  .stat-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .stat b {
    font-size: 24px;
  }
  .pager .next {
    text-align: left;
  }
}

@media print {
  .topbar,
  .outline,
  .rail,
  .pager,
  .skip,
  .menu-toggle {
    display: none !important;
  }
  .shell {
    display: block;
    padding: 0;
  }
  details {
    border: 0;
  }
  details > .details-body {
    display: block;
  }
  .rise,
  .reveal {
    animation: none;
  }
}
