:root {
  --bg: #fbf8f3;
  --bg-alt: #f3ede3;
  --surface: #ffffff;
  --text: #1d2430;
  --muted: #5f6673;
  --border: #e4dccf;
  --primary: #1f3a5f;
  --primary-ink: #ffffff;
  --accent: #c9822e;
  --accent-soft: #f7e6cf;
  --good: #2f7d5b;
  --good-soft: #dcefe5;
  --cell-off: #ece5d9;
  --shadow: 0 1px 2px rgba(29, 36, 48, 0.06), 0 8px 24px rgba(29, 36, 48, 0.06);
  --radius: 14px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181f;
    --bg-alt: #1a1f28;
    --surface: #202632;
    --text: #ece8e1;
    --muted: #a3a9b4;
    --border: #2f3644;
    --primary: #8fb4e3;
    --primary-ink: #0f1520;
    --accent: #e7a75a;
    --accent-soft: #3a2e1f;
    --good: #6fcf9f;
    --good-soft: #1f3a2e;
    --cell-off: #2a313d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 120px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 0.5em; font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 1.25em 0 0.4em; }
p { margin: 0 0 1em; }
a { color: var(--primary); }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; }
.muted { color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--muted); }
.eyebrow { display: inline-block; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin-bottom: 0.5rem; }

.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }
.section-intro { color: var(--muted); max-width: 680px; margin-bottom: 2rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.7em 1.3em; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 0.95rem var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-small { padding: 0.4em 0.9em; font-size: 0.85rem; }
.btn-ghost { background: transparent; color: var(--muted); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.logo-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: var(--primary-ink); font-size: 1.05rem; }
.site-nav { display: flex; gap: 1.5rem; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.site-nav a:hover { color: var(--text); }

/* Home hero */
.hero { padding: 96px 0 80px; }
.hero-inner { max-width: 820px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lead { margin: 1.25rem 0 2rem; max-width: 640px; }

.method { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.method-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.method-num { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 1rem; }
.method-step p { color: var(--muted); margin: 0; }

/* Book covers */
.cover {
  --w: 140px;
  position: relative; flex-shrink: 0;
  width: var(--w); aspect-ratio: 2 / 3;
  background: var(--cover-bg); color: var(--cover-fg);
  border-radius: 4px 10px 10px 4px;
  padding: 18px 14px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px;
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, 0.18), var(--shadow);
  overflow: hidden;
}
.cover::before { content: ""; position: absolute; top: -30%; right: -40%; width: 120%; aspect-ratio: 1; border-radius: 50%; background: var(--cover-accent); opacity: 0.22; }
.cover-rule { position: relative; width: 32px; height: 3px; background: var(--cover-accent); }
.cover-title { position: relative; font-family: var(--font-head); font-weight: 700; font-size: calc(var(--w) * 0.105); line-height: 1.15; }
.cover-author { position: relative; font-size: calc(var(--w) * 0.075); opacity: 0.8; }
.cover-lg { --w: 220px; }
.cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--cover-bg); z-index: 1; }

.cover-sm { --w: 96px; padding: 12px 10px; gap: 5px; }
.cover-sm .cover-rule { width: 20px; height: 2px; }
.cover-xs { --w: 44px; padding: 5px; gap: 0; border-radius: 2px 5px 5px 2px; }
.cover-xs .cover-title, .cover-xs .cover-author { display: none; }
.cover-xs .cover-rule { width: 14px; height: 2px; }

[hidden] { display: none !important; }

/* Library grid */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.book-card {
  display: flex; gap: 18px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.book-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.book-card-body { display: flex; flex-direction: column; min-width: 0; }
.book-card h3 { font-size: 1.08rem; margin-bottom: 0.15em; }
.book-num { font-size: 0.75rem; font-weight: 700; color: var(--accent); }
.book-author { font-size: 0.88rem; margin-bottom: 0.4em; }
.book-blurb { font-size: 0.9rem; line-height: 1.5; margin-bottom: 0.6em; }
.book-card-meta { margin-top: auto; font-size: 0.8rem; font-weight: 600; color: var(--primary); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 0.6em; }
.badge { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.25em 0.65em; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge-start { background: var(--good-soft); color: var(--good); }

/* Start here */
.start-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 10px; }
.start-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.start-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.start-rank { flex-shrink: 0; width: 28px; font-family: var(--font-head); font-size: 1.4rem; font-weight: 700; color: var(--accent); text-align: center; }
.start-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; flex: 1; }
.start-text .muted { font-size: 0.88rem; }
.start-cat { flex-shrink: 0; font-size: 0.72rem; font-weight: 600; color: var(--muted); background: var(--bg-alt); padding: 0.25em 0.7em; border-radius: 999px; }

/* Library tools */
.library-tools { display: flex; flex-direction: column; gap: 14px; margin-bottom: 8px; padding: 12px 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 0.5em 1em; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 0.88rem var(--font-body); cursor: pointer; }
.chip span { font-size: 0.75rem; color: var(--muted); }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.chip.active span { color: inherit; opacity: 0.75; }
.chip-sm { padding: 0.35em 0.85em; font-size: 0.8rem; }
.chips-tags { flex-wrap: wrap; overflow: visible; }
.show-all { margin-top: 16px; }
.search { width: 100%; max-width: 420px; padding: 0.7em 1em; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.category-section { padding-top: 40px; }
.category-head { border-left: 4px solid var(--cat, var(--accent)); padding-left: 16px; margin-bottom: 20px; }
.category-head h2 { margin-bottom: 0.2em; }
.category-head p { margin: 0; }
.no-results { padding: 40px 0; text-align: center; }

/* Callouts */
.callout { border-radius: 12px; padding: 14px 18px; margin-bottom: 1.5rem; font-size: 0.95rem; }
.callout strong { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.2rem; }
.callout p { margin: 0; }
.callout-note { background: var(--accent-soft); border-left: 4px solid var(--accent); }
.callout-note strong { color: var(--accent); }
.callout-disclaimer { background: var(--bg-alt); border-left: 4px solid var(--muted); color: var(--muted); }

/* Breadcrumb & pager */
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 28px; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 24px; padding-bottom: 56px; }
.pager-link { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; font-family: var(--font-head); font-weight: 700; }
.pager-link .muted { font-family: var(--font-body); font-weight: 500; font-size: 0.82rem; }
.pager-link:hover { border-color: var(--accent); }
.pager-next { text-align: right; }

.footer-cats { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 16px; }
.footer-cats a { color: var(--muted); font-weight: 500; text-decoration: none; }
.footer-cats a:hover { color: var(--text); }

/* Book hero */
.book-hero { padding: 64px 0; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.book-hero-inner { display: flex; gap: 48px; align-items: center; }
.book-hero .subtitle { font-family: var(--font-head); font-size: 1.25rem; margin-bottom: 0.25em; }
.tagline { margin: 1.5rem 0; padding-left: 1rem; border-left: 3px solid var(--accent); font-size: 1.1rem; font-style: italic; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* On-page nav */
.toc { position: sticky; top: 64px; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--border); }
.toc-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.toc a { padding: 14px 14px; white-space: nowrap; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.92rem; border-bottom: 2px solid transparent; }
.toc a:hover { color: var(--text); border-bottom-color: var(--accent); }

/* Big ideas */
.ideas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 2rem; }
.idea-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.idea-card h3 { font-size: 1.1rem; }
.idea-card p { color: var(--muted); margin: 0; font-size: 0.95rem; }

/* Lessons */
.group-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1.5rem; }
.pill { font-size: 0.8rem; font-weight: 600; padding: 0.3em 0.8em; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.lessons { display: grid; gap: 24px; }
.lesson { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.lesson-head { display: flex; align-items: center; gap: 16px; margin-bottom: 0.5rem; }
.lesson-head h3 { font-size: 1.5rem; margin: 0; }
.lesson-head .eyebrow { margin-bottom: 0.15rem; }
.lesson-num { display: grid; place-items: center; flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-family: var(--font-head); font-size: 1.5rem; font-weight: 700; }
.lesson-body { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.lesson-text p { color: var(--text); }
.steps { padding-left: 1.2rem; margin: 0 0 1.25rem; }
.steps li { margin-bottom: 0.6em; padding-left: 0.3rem; }
.steps li::marker { color: var(--accent); font-weight: 700; }
.tiny-habit { background: var(--good-soft); border-radius: 10px; padding: 14px 16px; margin-bottom: 1rem; }
.tiny-habit p { margin: 0.25rem 0 0; font-weight: 500; }
.tiny-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--good); }
.reflect { font-style: italic; color: var(--muted); margin: 0; }
.reflect span { font-style: normal; font-weight: 600; color: var(--accent); }

/* Matrix */
.matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 1rem; }
.matrix-axis { grid-column: 1 / -1; /* spans both columns */ display: grid; grid-template-columns: 1fr 1fr; text-align: center; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.matrix-cell { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 0.85rem; background: var(--bg); }
.matrix-cell span { color: var(--muted); }
.matrix-cell em { font-style: normal; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; }
.matrix-q { font-family: var(--font-head); font-weight: 700; color: var(--text) !important; }
.tone-focus { background: var(--good-soft); border-color: var(--good); }
.tone-focus em { color: var(--good); }
.tone-manage em { color: var(--accent); }
.tone-limit em, .tone-avoid em { color: var(--muted); }

/* Routine */
.routine { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.routine-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; border-top: 4px solid var(--accent); }
.routine-col ul { margin: 0; padding-left: 1.1rem; }
.routine-col li { margin-bottom: 0.5em; }

/* Plan */
.plan { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.plan-week { display: flex; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.plan-num { flex-shrink: 0; width: 64px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); padding-top: 4px; }
.plan-week h3 { font-size: 1.15rem; margin-bottom: 0.2em; }
.plan-week p { font-size: 0.92rem; margin-bottom: 0.6em; }
.checklist { list-style: none; padding: 0; margin: 0; font-size: 0.92rem; }
.checklist li { position: relative; padding-left: 1.5rem; margin-bottom: 0.4em; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }

/* Tracker */
.tracker { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: start; }
.tracker-today, .tracker-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.tracker-head h3 { display: flex; flex-wrap: wrap; gap: 0.5em; align-items: baseline; }
.tracker-head h3 .muted { font-family: var(--font-body); font-weight: 400; font-size: 0.95rem; }
.progress { height: 8px; border-radius: 99px; background: var(--cell-off); overflow: hidden; margin-bottom: 1.25rem; }
.progress span { display: block; height: 100%; background: var(--good); border-radius: 99px; transition: width 0.3s ease; }
.today-list { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: 8px; }
.today-list label { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; line-height: 1.35; }
.today-list label:hover { border-color: var(--accent); }
.today-list label.is-done { background: var(--good-soft); border-color: var(--good); }
.today-list input { width: 20px; height: 20px; accent-color: var(--good); flex-shrink: 0; }
.today-list .muted { font-size: 0.88rem; }
.check-num { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--bg-alt); font-weight: 700; font-size: 0.85rem; }
.notes-label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.4rem; }
textarea { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; resize: vertical; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; align-items: center; padding: 12px 6px; background: var(--bg-alt); border-radius: 10px; font-size: 0.82rem; }
.stat-num { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.history { display: grid; grid-template-columns: 20px repeat(var(--days), 1fr); gap: 3px; margin-bottom: 1rem; }
.history-label { font-size: 0.72rem; font-weight: 600; color: var(--muted); display: grid; place-items: center; }
.cell { aspect-ratio: 1; min-width: 0; padding: 0; border: 0; border-radius: 3px; background: var(--cell-off); cursor: pointer; }
.cell.on { background: var(--good); }
.cell.today { outline: 1.5px solid var(--accent); outline-offset: 1px; }
.cell:hover { filter: brightness(0.9); }

/* Weekly review */
.review-list { padding-left: 1.4rem; }
.review-list li { margin-bottom: 0.8em; font-size: 1.05rem; }
.review-list li::marker { color: var(--accent); font-family: var(--font-head); font-weight: 700; }

/* Footer */
.site-footer { padding: 40px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.88rem; }

/* Responsive */
@media (max-width: 900px) {
  .lesson-body, .tracker { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 640px) {
  .section { padding: 48px 0; }
  .hero { padding: 64px 0 48px; }
  .book-card .cover-sm { --w: 72px; }
  .book-card .cover-sm .cover-title { font-size: 8px; }
  .book-card .cover-sm .cover-author { display: none; }
  .hide-sm { display: none; }
  .start-cat { display: none; }
  .pager { grid-template-columns: 1fr; }
  .book-hero-inner { flex-direction: column; align-items: flex-start; gap: 28px; }
  .cover-lg { --w: 160px; }
  .lesson { padding: 20px; }
  .plan-week { flex-direction: column; gap: 4px; }
  .site-nav { gap: 1rem; }
  .history { gap: 2px; }
}

/* Ask the owl */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.owl-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 3px 12px 3px 3px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 0.88rem var(--font-body); cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.owl-btn:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.owl-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background-color: #fbf3e4; background-repeat: no-repeat;
  background-size: 260%; background-position: 40% 20%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.site-nav { align-items: center; }

.owl-dialog {
  width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 28px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--bg); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}
.owl-dialog::backdrop { background: rgba(15, 20, 30, 0.55); backdrop-filter: blur(2px); }
.owl-close { position: absolute; top: 10px; right: 14px; border: 0; background: none; color: var(--muted); font-size: 1.8rem; line-height: 1; cursor: pointer; }
.owl-close:hover { color: var(--text); }
.owl-head { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.owl-head h2 { margin-bottom: 0.25em; font-size: 1.5rem; }
.owl-head p { margin: 0; }
.owl-img { width: 150px; height: 150px; flex-shrink: 0; object-fit: contain; border-radius: 16px; background: #fbf3e4; }
.owl-form { display: grid; gap: 12px; }
.owl-form textarea { font-size: 1rem; }
.owl-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.owl-form .btn { justify-self: start; }
.owl-output:not(:empty) { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.owl-say { font-size: 1rem; margin-bottom: 12px; }
.owl-results { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.owl-card { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; }
.owl-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.owl-card-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.4; min-width: 0; }
.owl-card-text .muted { font-size: 0.85rem; }
.owl-why { font-size: 0.9rem; }
.owl-lesson { font-size: 0.82rem; font-weight: 600; color: var(--good); }
.owl-hint { font-size: 0.85rem; margin: 12px 0 0; }
.owl-footnote { font-size: 0.78rem; margin: 18px 0 0; }
.owl-crisis { background: var(--accent-soft); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.owl-crisis p { margin: 0.3em 0 0; }

.start-owl { display: flex; align-items: center; gap: 16px; margin: -8px 0 24px; padding: 12px 18px 12px 12px; border: 1px dashed var(--accent); border-radius: 14px; background: var(--surface); max-width: 640px; }
.start-owl img { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: #fbf3e4; flex-shrink: 0; }
.start-owl p { margin: 0; }
.start-owl a { font-weight: 600; }

@media (max-width: 640px) {
  .owl-btn-text { display: none; }
  .owl-btn { padding: 3px; }
  .owl-dialog { padding: 20px 16px; }
  .owl-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .owl-img { width: 96px; height: 96px; }
}

/* Keep the header on one line on small screens */
.site-nav a, .logo { white-space: nowrap; }
@media (max-width: 640px) {
  .logo { font-size: 1.02rem; gap: 0.45rem; }
  .logo-mark { width: 28px; height: 28px; font-size: 0.95rem; }
  .site-nav { gap: 0.8rem; }
  .site-nav a { font-size: 0.88rem; }
}
@media (max-width: 360px) {
  .logo-text { display: none; }
}

/* Learning loop: journey, reviews, recall, results */
.section-journey { padding: 48px 0; background: var(--bg); border-bottom: 1px solid var(--border); }
.section-journey:empty { display: none; }
.journey-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.journey-card h2 { margin-bottom: 0.35em; }
.journey-form, .journey-panel { display: grid; gap: 18px; margin-top: 18px; }
.journey-panel { background: var(--bg-alt); border-radius: 12px; padding: 20px; margin: 20px 0; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 0.95rem; border: 0; padding: 0; margin: 0; min-width: 0; }
.field legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.field input[type="date"], .field input[type="time"], .field select, .rating-select {
  font: inherit; font-weight: 400; padding: 0.5em 0.7em; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); max-width: 260px;
}
.field textarea { font-weight: 400; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.small { font-size: 0.85rem; font-weight: 400; }
.baseline-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-weight: 400; }
.baseline-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.rating-select { width: 76px; flex-shrink: 0; }
.journey-warn { background: var(--accent-soft); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 10px; font-size: 0.92rem; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--primary); font: inherit; text-decoration: underline; cursor: pointer; text-align: left; }

.journey-dash { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: start; }
.journey-main, .journey-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.journey-main h2 { margin-bottom: 0.4em; }
.journey-progress { margin-bottom: 16px; }
.journey-why { margin: 0 0 18px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--bg-alt); border-radius: 0 10px 10px 0; font-style: italic; }
.journey-why span { font-style: normal; font-weight: 600; color: var(--accent); }
.journey-week h3, .journey-todo h3, .recall-wrap h3, .journey-side h3 { font-size: 1.1rem; }
.journey-callout { background: var(--good-soft); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.journey-callout p { margin: 0.3em 0 0.8em; }
.todo-list { margin: 0 0 8px; padding-left: 1.2rem; }
.todo-list li { margin-bottom: 0.4em; }
.todo-list li.due { font-weight: 600; }
.journey-actions { display: grid; gap: 8px; margin-top: 16px; }
.journey-actions .btn { justify-content: center; }

.rating-bars { display: grid; gap: 8px; }
.rating-row { display: grid; grid-template-columns: minmax(0, 1.3fr) 1fr 34px; gap: 10px; align-items: center; font-size: 0.85rem; }
.rating-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rating-track { position: relative; height: 12px; border-radius: 99px; background: var(--cell-off); overflow: hidden; }
.rating-start, .rating-now { position: absolute; left: 0; height: 50%; border-radius: 99px; }
.rating-start { top: 0; background: var(--muted); opacity: 0.55; }
.rating-now { bottom: 0; background: var(--good); }
.rating-diff { text-align: right; font-weight: 700; color: var(--muted); }
.rating-diff.up { color: var(--good); }
.rating-diff.down { color: var(--accent); }
.rating-legend { font-size: 0.78rem; display: flex; align-items: center; gap: 6px; margin: 4px 0 0; }
.key { display: inline-block; width: 14px; height: 6px; border-radius: 4px; }
.key-start { background: var(--muted); opacity: 0.55; }
.key-now { background: var(--good); margin-left: 8px; }

.recall-wrap { margin-top: 20px; }
.recall-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; background: var(--bg); display: grid; gap: 8px; }
.recall-card p { margin: 0; }
.recall-idea { background: var(--good-soft); border-radius: 10px; padding: 10px 12px; margin: 4px 0 !important; }
.recall-idea span { font-weight: 700; color: var(--good); }
.recall-grade { display: flex; gap: 8px; flex-wrap: wrap; }

.final-lessons { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 16px; counter-reset: lesson; }
.final-lesson { border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: grid; gap: 12px; background: var(--bg); }
.final-lesson h3 { margin: 0; font-size: 1.1rem; }
.final-lesson .btn { justify-self: start; }
.inline-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-weight: 400; }
.inline-choices legend { width: 100%; font-weight: 600; }
.inline-choices label { display: inline-flex; align-items: center; gap: 6px; }
.keep-choice { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; padding: 6px 0; }
.keep-choice input { margin-top: 4px; }

.results-stats { max-width: 560px; margin: 16px 0; }
.results-table { display: grid; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.results-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 8px; padding: 10px 14px; font-size: 0.9rem; border-top: 1px solid var(--border); }
.results-row:first-child { border-top: 0; }
.results-head { background: var(--bg-alt); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.match-0 { color: var(--good); font-weight: 600; }
.match-1 { color: var(--accent); font-weight: 600; }
.match-2 { color: var(--muted); }
.results-text { white-space: pre-line; }
.evidence-list { padding-left: 1.2rem; }
.evidence-list li { margin-bottom: 0.5em; }

.section-practice { padding: 48px 0; }
.practice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.practice-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); text-decoration: none; }
.practice-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.practice-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.4; min-width: 0; }
.practice-text .muted { font-size: 0.85rem; }
.practice-nudge { font-size: 0.82rem; font-weight: 600; color: var(--accent); }
.practice-done { margin-top: 16px; }
.practice-done summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
.practice-tools { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .journey-dash { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .journey-card, .journey-main, .journey-side { padding: 18px; }
  .results-row { grid-template-columns: 1.6fr 0.8fr 1fr; }
  .results-row span:nth-child(4) { display: none; }
}

/* Print only the results page */
@media print {
  body.print-results .site-header, body.print-results .site-footer, body.print-results .book-hero,
  body.print-results .toc, body.print-results #book-root > section:not(#journey), body.print-results .pager,
  body.print-results .no-print, body.print-results .owl-btn { display: none !important; }
  body.print-results .journey-card { box-shadow: none; border: 0; }
  body.print-results { background: #fff; color: #000; }
}
