/* ============================================================
   PDPM Course — Civic Editorial
   Refined typography, oversized chapter numerals, drop caps,
   subtle paper grain, micro-interactions. Editorial gravitas
   for a serious professional manual. All selectors used by
   shared.js are preserved.
   ============================================================ */

:root {
  /* Type system */
  --serif:      'Fraunces', Georgia, 'Times New Roman', serif;
  --serif-disp: 'Instrument Serif', 'Fraunces', Georgia, serif;
  --sans:       'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  --mono:       'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  /* Ink */
  --ink:         #181a20;
  --ink-soft:    #353940;
  --ink-muted:   #6c7079;
  --ink-faint:   #9aa0a8;

  /* Paper — warm cream */
  --paper:       #f4ede0;
  --paper-2:     #faf4e7;
  --paper-3:     #fffdf5;
  --paper-deep:  #ece4d2;

  /* Hairlines */
  --line:        #d0c8b5;
  --line-soft:   #e6dfcb;
  --line-faint:  #efe9d8;

  /* Accents — deeper terracotta + sparing cool */
  --accent:      #b14a16;
  --accent-deep: #6e2d08;
  --accent-soft: rgba(177, 74, 22, 0.10);
  --accent-tint: rgba(177, 74, 22, 0.04);

  --cool:        #1d3845;
  --cool-soft:   rgba(29, 56, 69, 0.06);

  /* Status */
  --good:        #2f6b3a;
  --good-bg:     #e1ecd4;
  --bad:         #862518;
  --bad-bg:      #f1d7d0;
  --warn:        #876412;
  --warn-bg:     #f1e5be;

  /* Shadow */
  --shadow-sm:   0 1px 0 rgba(24,26,32,0.04);
  --shadow:      0 1px 0 rgba(24,26,32,0.04), 0 8px 28px -14px rgba(24,26,32,0.18);
}

/* Subtle paper grain — inline SVG fractal noise */
html {
  background-color: var(--paper);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.094 0 0 0 0 0.102 0 0 0 0 0.126 0 0 0 0.035 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-repeat: repeat;
}

* { box-sizing: border-box; }
*::selection { background: var(--accent-soft); color: var(--ink); }

html, body {
  margin: 0; padding: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-variation-settings: "opsz" 14;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}
body { background: transparent; }

a {
  color: var(--accent-deep);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 95%;
  background-repeat: no-repeat;
  transition: color .18s ease, background-size .18s ease;
}
a:hover { color: var(--accent); background-size: 100% 2px; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   Layout
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 308px 1fr;
  min-height: 100vh;
  overflow-x: hidden;
}
.app > * { min-width: 0; }  /* allow grid children to shrink despite wide descendants (figures, etc.) */
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  background: var(--paper-2);
  border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 32px 22px 40px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

@media (max-width: 900px) {
  .sidebar {
    position: static; height: auto; overflow: visible;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 18px 18px 20px;
  }
  .sidebar .brand { margin-bottom: 14px; padding-bottom: 14px; }
  .sidebar .progress-card { margin-bottom: 14px; }
  .sidebar .nav-list { max-height: 360px; overflow-y: auto; }
  .sidebar details.nav-collapse > summary {
    list-style: none; cursor: pointer;
    font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--ink-muted);
    padding: 11px 4px; border-top: 1px solid var(--line-soft);
    display: flex; justify-content: space-between; align-items: center;
  }
  .sidebar details.nav-collapse > summary::-webkit-details-marker { display: none; }
  .sidebar details.nav-collapse > summary::after {
    content: "▾"; font-size: 12px; transition: transform .2s ease; color: var(--accent);
  }
  .sidebar details.nav-collapse[open] > summary::after { transform: rotate(180deg); }
}

.brand {
  display: block;
  margin-bottom: 22px; padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  text-decoration: none; background: none; background-image: none;
}
.brand:hover { background-image: none; }
.brand-mark {
  font-family: var(--serif-disp);
  font-style: italic;
  font-size: 30px; font-weight: 400;
  letter-spacing: -0.005em; line-height: 1.0;
  color: var(--ink);
  margin-bottom: 4px;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-muted);
}

.progress-card {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px 16px 12px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.progress-card .row { display: flex; justify-content: space-between; align-items: baseline; }
.progress-card .num {
  font-family: var(--serif);
  font-size: 32px; font-weight: 500;
  font-variation-settings: "opsz" 60;
  line-height: 1; letter-spacing: -0.015em;
  color: var(--ink);
}
.progress-card .lbl {
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-muted);
}
.progress-bar {
  height: 3px; background: var(--line-soft);
  margin-top: 12px; position: relative; overflow: hidden;
  border-radius: 2px;
}
.progress-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  transition: width .55s cubic-bezier(.2,.6,.2,1);
}
.reset-link {
  display: block; margin-top: 12px;
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-muted);
  background: none; border: 0; padding: 0;
  text-decoration: underline; text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer; transition: color .15s ease;
}
.reset-link:hover { color: var(--bad); }

.part-group { margin-bottom: 14px; }
.part-title {
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-muted);
  padding: 12px 4px 6px;
  display: flex; align-items: center; gap: 8px;
}
.part-title::before {
  content: ""; display: inline-block;
  width: 6px; height: 1px; background: var(--accent);
}
.nav-item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 10px; border-radius: 3px; cursor: pointer;
  color: var(--ink); text-decoration: none;
  border-left: 2px solid transparent;
  line-height: 1.3;
  background: none;
  background-image: none;
  transition: background .15s ease, border-color .15s ease;
}
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item.active {
  background: var(--paper-3);
  border-left-color: var(--accent);
  color: var(--ink);
}
.nav-item .ch-num {
  font-family: var(--mono); font-size: 10px;
  color: var(--ink-muted);
  min-width: 22px; text-align: right;
  letter-spacing: 0.02em;
}
.nav-item.active .ch-num { color: var(--accent-deep); font-weight: 500; }
.nav-item .ch-name {
  font-family: var(--sans);
  font-size: 13px; flex: 1;
  font-variation-settings: "opsz" 14, "wght" 420;
  letter-spacing: -0.005em;
}
.nav-item.active .ch-name { font-variation-settings: "opsz" 14, "wght" 540; }
.nav-item .ch-status { font-size: 11px; }
.nav-item .ch-status.done { color: var(--good); }
.nav-item .ch-status.partial { color: var(--warn); }
.nav-item .ch-status.stub { color: var(--ink-faint); font-style: italic; }

/* ============================================================
   Main column
   ============================================================ */
.main {
  padding: 64px 72px 120px;
  max-width: 940px;
  position: relative;
}
@media (max-width: 1100px) { .main { padding: 56px 48px 100px; } }
@media (max-width: 900px)  { .main { padding: 32px 22px 80px; } }
@media (max-width: 480px)  { .main { padding: 24px 16px 64px; } }

/* Page-load reveal cascade */
.main > * { animation: rise .55s cubic-bezier(.2,.7,.2,1) backwards; }
.main > *:nth-child(1) { animation-delay: 0.00s; }
.main > *:nth-child(2) { animation-delay: 0.04s; }
.main > *:nth-child(3) { animation-delay: 0.08s; }
.main > *:nth-child(4) { animation-delay: 0.12s; }
.main > *:nth-child(5) { animation-delay: 0.16s; }
.main > *:nth-child(6) { animation-delay: 0.20s; }
.main > *:nth-child(n+7) { animation-delay: 0.22s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .main > * { animation: none; }
  html { scroll-behavior: auto; }
}

/* Crumb */
.crumb {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-muted);
  margin-bottom: 18px;
}
.crumb a { color: var(--ink-muted); background-image: none; }
.crumb a:hover { color: var(--accent-deep); }

/* Chapter eyebrow */
.chapter-num {
  font-family: var(--serif-disp);
  font-style: italic;
  font-size: 18px;
  color: var(--accent-deep);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}

/* Chapter title — Fraunces, optical-sizing */
h1.chapter-title {
  font-family: var(--serif);
  font-weight: 460;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: clamp(36px, 4.6vw, 54px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0 0 22px;
  color: var(--ink);
}

/* Meta row */
.meta-row {
  display: flex; gap: 24px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.08em; color: var(--ink-muted);
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
  text-transform: uppercase;
}
.meta-row span strong {
  color: var(--ink); font-weight: 500;
  font-family: var(--mono);
}
.meta-row a { color: var(--accent-deep); background-image: none; }
.meta-row a:hover { color: var(--accent); }
.pdf-link {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.08em;
}

/* Section headers within body */
h2 {
  font-family: var(--serif);
  font-weight: 450;
  font-variation-settings: "opsz" 72;
  font-size: 28px;
  letter-spacing: -0.018em;
  margin: 52px 0 18px;
  line-height: 1.18;
  color: var(--ink);
  position: relative;
  padding-top: 22px;
}
h2::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 32px; height: 1px;
  background: var(--accent);
}

h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-variation-settings: "wght" 600, "opsz" 12;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 32px 0 12px;
}

/* Lead paragraph — with drop cap */
.lead {
  font-family: var(--serif);
  font-variation-settings: "opsz" 28, "SOFT" 50;
  font-size: clamp(19px, 1.6vw, 22px);
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 32px;
  font-weight: 380;
  letter-spacing: -0.008em;
}
.lead::first-letter {
  font-family: var(--serif-disp);
  font-style: italic;
  font-size: 4.2em;
  line-height: 0.92;
  float: left;
  padding: 0.08em 0.10em 0 0;
  color: var(--accent-deep);
  font-weight: 400;
  margin-top: 0.02em;
}
@media (max-width: 600px) {
  .lead::first-letter { font-size: 3.4em; padding-right: 0.08em; }
}

/* Objectives — refined card with corner ticks */
.objectives {
  background: var(--paper-3);
  border: 1px solid var(--line);
  padding: 22px 26px 20px;
  margin-bottom: 36px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.objectives::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 28px; height: 28px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}
.objectives::after {
  content: "";
  position: absolute;
  bottom: -1px; right: -1px;
  width: 28px; height: 28px;
  border-bottom: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}
.objectives h3 { margin-top: 0; color: var(--accent-deep); }
.objectives ul { margin: 0; padding-left: 22px; list-style: none; }
.objectives li {
  margin-bottom: 8px;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  position: relative;
  padding-left: 8px;
}
.objectives li::before {
  content: "→";
  position: absolute;
  left: -16px; top: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
}

/* Body prose */
.body p {
  font-family: var(--serif);
  font-variation-settings: "opsz" 16, "SOFT" 80;
  font-size: 17px;
  line-height: 1.7;
  margin: 0 0 18px;
  color: var(--ink-soft);
  letter-spacing: -0.003em;
}
.body strong { color: var(--ink); font-weight: 550; }
.body em.term {
  font-style: normal;
  font-weight: 500;
  color: var(--accent-deep);
  font-variation-settings: "opsz" 16, "wght" 500;
}
.body ul, .body ol {
  padding-left: 22px;
  margin: 0 0 18px;
}
.body li {
  font-family: var(--serif);
  font-variation-settings: "opsz" 16;
  font-size: 16px;
  line-height: 1.65;
  margin-bottom: 8px;
  color: var(--ink-soft);
}
.body ul li::marker { color: var(--accent); }
.body ol { counter-reset: list; padding-left: 0; }
.body ol > li {
  counter-increment: list;
  list-style: none;
  position: relative;
  padding-left: 32px;
}
.body ol > li::before {
  content: counter(list, decimal) ".";
  position: absolute;
  left: 0; top: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  line-height: 1.9;
  letter-spacing: 0.02em;
}
.body code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 2px;
  color: var(--accent-deep);
}

/* Mobile body sizing */
@media (max-width: 900px) {
  h2 { font-size: 22px; margin: 36px 0 12px; padding-top: 16px; }
  .body p, .body li { font-size: 15.5px; line-height: 1.62; }
}

/* ============================================================
   Terms grid — refined
   ============================================================ */
.terms-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--paper-3);
  margin: 16px 0 0;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 700px) { .terms-grid { grid-template-columns: 1fr; } }
.term-cell {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  transition: background .15s ease;
}
.term-cell:nth-child(2n) { border-right: 0; }
.term-cell:hover { background: var(--paper-2); }
.term-cell .term-key {
  font-family: var(--mono);
  font-size: 11.5px; font-weight: 500;
  color: var(--accent-deep);
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}
.term-cell .term-def {
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 14.5px;
  line-height: 1.52;
  color: var(--ink-soft);
}

/* ============================================================
   Quiz
   ============================================================ */
.quiz { margin-top: 56px; }

.quiz-intro {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px 22px;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
  box-shadow: var(--shadow-sm);
}
.quiz-intro .qi-l {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 19px;
  font-weight: 460;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.quiz-intro .qi-r {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.quiz-intro .qi-r .score {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-style: italic;
  font-size: 19px;
  color: var(--ink);
  margin-left: 8px;
  text-transform: none;
  letter-spacing: -0.005em;
}

.question {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 20px 24px;
  margin-bottom: 16px;
  background: var(--paper-3);
  transition: border-color .2s ease, box-shadow .2s ease;
  box-shadow: var(--shadow-sm);
}
.question:hover { border-color: var(--ink-faint); }
.question .q-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
}
.question .q-text {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24, "SOFT" 50;
  font-size: 19px;
  line-height: 1.4;
  margin-bottom: 16px;
  font-weight: 460;
  color: var(--ink);
  letter-spacing: -0.012em;
}

.options { display: flex; flex-direction: column; gap: 8px; }
.opt {
  text-align: left;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink);
  display: flex; gap: 12px; align-items: flex-start;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
  background-image: none;
}
.opt:hover:not(:disabled) {
  background: var(--paper);
  border-color: var(--ink-muted);
  transform: translateX(2px);
}
.opt:disabled { cursor: default; transform: none; }
.opt .letter {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
  min-width: 18px;
  padding-top: 1px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.opt.correct {
  background: var(--good-bg);
  border-color: var(--good);
  animation: pulse-good .4s ease;
}
.opt.correct .letter { color: var(--good); font-weight: 600; }
.opt.incorrect {
  background: var(--bad-bg);
  border-color: var(--bad);
  animation: pulse-bad .4s ease;
}
.opt.incorrect .letter { color: var(--bad); font-weight: 600; }
.opt.faded { opacity: 0.55; transform: none; }
@keyframes pulse-good {
  0% { transform: scale(1); }
  40% { transform: scale(1.015); }
  100% { transform: scale(1); }
}
@keyframes pulse-bad {
  0% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

.explanation {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--paper);
  border-left: 2px solid var(--accent);
  border-radius: 0 3px 3px 0;
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  animation: rise .35s ease backwards;
}
.explanation strong { color: var(--ink); }

@media (max-width: 900px) {
  .opt { padding: 14px 14px; min-height: 44px; font-size: 14px; }
  .question .q-text { font-size: 17px; }
  .quiz-intro .qi-l { font-size: 17px; }
}

.quiz-actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  font-variation-settings: "wght" 520;
  padding: 11px 22px;
  border-radius: 3px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-3);
  letter-spacing: 0.02em;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.btn:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  transform: translateY(-1px);
}
.btn.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn.secondary:hover {
  background: var(--paper-3);
  color: var(--accent-deep);
  border-color: var(--accent-deep);
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
@media (max-width: 900px) { .btn { padding: 13px 22px; min-height: 44px; } }

/* Completion banner */
.complete-banner {
  margin-top: 28px;
  padding: 20px 24px;
  border-radius: 4px;
  background: var(--good-bg);
  border: 1px solid var(--good);
  color: var(--good);
  font-family: var(--serif);
  font-variation-settings: "opsz" 20;
  font-size: 18px;
  font-weight: 450;
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
  letter-spacing: -0.005em;
}
.complete-banner button {
  background: transparent;
  border: 1px solid var(--good);
  color: var(--good);
  padding: 8px 14px;
  font-size: 12px;
  font-family: var(--sans);
  font-weight: 500;
  border-radius: 3px;
  letter-spacing: 0.02em;
  transition: background .15s ease;
}
.complete-banner button:hover { background: rgba(47, 107, 58, 0.10); }
.complete-banner.warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.complete-banner.warn button { border-color: var(--warn); color: var(--warn); }
.complete-banner.warn button:hover { background: rgba(135, 100, 18, 0.10); }

/* Chapter footer (prev/next) */
.chapter-footer {
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.chapter-footer .nav-btn {
  font-family: var(--serif);
  font-variation-settings: "opsz" 18;
  font-size: 17px;
  font-weight: 450;
  color: var(--ink);
  text-decoration: none;
  display: flex; flex-direction: column; gap: 4px;
  background-image: none;
  letter-spacing: -0.01em;
  transition: color .15s ease;
}
.chapter-footer .nav-btn small {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.chapter-footer .nav-btn:hover { color: var(--accent-deep); }
.chapter-footer .nav-btn:hover small { color: var(--accent); }
.chapter-footer .nav-btn.right { text-align: right; align-items: flex-end; margin-left: auto; }

/* ============================================================
   Home / index
   ============================================================ */
.home-hero {
  margin-bottom: 52px;
  padding-top: 8px;
}
.home-hero .eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 10px;
}
.home-hero .eyebrow::before {
  content: ""; display: inline-block;
  width: 18px; height: 1px; background: var(--accent);
}
.home-hero h1 {
  font-family: var(--serif);
  font-weight: 420;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.035em;
  margin: 0 0 22px;
  color: var(--ink);
}
.home-hero h1 em {
  font-family: var(--serif-disp);
  font-style: italic;
  font-weight: 400;
  font-variation-settings: normal;
  color: var(--accent-deep);
}
@media (max-width: 700px) {
  .home-hero h1 { font-size: clamp(34px, 9vw, 44px); }
}
.home-hero .deck {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: clamp(18px, 1.5vw, 21px);
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 380;
  max-width: 640px;
  letter-spacing: -0.008em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 36px 0 60px;
}
@media (max-width: 700px) { .stats { grid-template-columns: 1fr 1fr; gap: 10px; } }
.stat {
  background: var(--paper-3);
  border: 1px solid var(--line);
  padding: 20px 18px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
  box-shadow: var(--shadow-sm);
}
.stat::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 28px; height: 1px;
  background: var(--accent);
}
.stat:hover { border-color: var(--ink-muted); transform: translateY(-2px); }
.stat .v {
  font-family: var(--serif);
  font-variation-settings: "opsz" 96, "SOFT" 30;
  font-size: 40px;
  font-weight: 460;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.stat .l {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 8px;
}

.part-section { margin-bottom: 52px; }
.part-section .ph {
  display: flex; gap: 22px; align-items: baseline;
  margin-bottom: 18px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.part-section .ph::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 0;
  width: 48px; height: 1px;
  background: var(--accent);
}
.part-section .ph .pn {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 500;
}
.part-section .ph h2 {
  margin: 0;
  font-size: 28px;
  font-family: var(--serif-disp);
  font-style: italic;
  font-weight: 400;
  font-variation-settings: normal;
  padding: 0;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.part-section .ph h2::before { content: none; }

.chapter-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .chapter-cards { grid-template-columns: 1fr; } }
.ch-card {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px 20px;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
  position: relative;
  overflow: hidden;
  background-image: none;
  box-shadow: var(--shadow-sm);
}
.ch-card:hover {
  border-color: var(--ink-muted);
  transform: translateY(-2px);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.ch-card .cc-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.ch-card .cc-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24;
  font-size: 20px;
  font-weight: 460;
  line-height: 1.22;
  margin-bottom: 12px;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.ch-card .cc-status {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.ch-card .cc-status.done { color: var(--good); font-weight: 500; }
.ch-card .cc-status.partial { color: var(--warn); font-weight: 500; }
.ch-card .cc-status.stub { color: var(--ink-faint); font-style: italic; }
.ch-card .cc-stripe {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
  transition: background .15s ease;
}
.ch-card.done .cc-stripe { background: var(--good); }
.ch-card.partial .cc-stripe { background: var(--warn); }
.ch-card:hover .cc-stripe:not(.done):not(.partial) { background: var(--accent); }

/* ============================================================
   Figures
   ============================================================ */
figure.figure {
  margin: 36px 0;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 24px 28px 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 600px) { figure.figure { padding: 18px 14px 14px; margin: 28px 0; } }

/* Tufte-style corner ticks */
figure.figure::before, figure.figure::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  pointer-events: none;
}
figure.figure::before {
  top: -1px; left: -1px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
}
figure.figure::after {
  bottom: -1px; right: -1px;
  border-bottom: 1px solid var(--accent);
  border-right: 1px solid var(--accent);
}

figure.figure .fig-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 6px;
  font-weight: 500;
}
figure.figure .fig-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24, "SOFT" 50;
  font-size: 19px;
  font-weight: 460;
  color: var(--ink);
  margin-bottom: 16px;
  line-height: 1.28;
  letter-spacing: -0.015em;
}
figure.figure .fig-svg-wrap {
  background: var(--paper-2);
  border-radius: 3px;
  padding: 20px;
  margin: 0 -4px;
  border: 1px solid var(--line-faint);
}
figure.figure svg { display: block; width: 100%; height: auto; max-width: 100%; }

@media (max-width: 760px) {
  figure.figure .fig-svg-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px;
    margin: 0 -6px;
    position: relative;
  }
  figure.figure .fig-svg-wrap svg {
    width: auto; max-width: none;
    min-width: 640px; height: auto;
  }
  figure.figure .fig-svg-wrap::after {
    content: "swipe →";
    position: absolute; right: 8px; top: 4px;
    font-family: var(--mono); font-size: 9px;
    letter-spacing: 0.10em; color: var(--ink-muted);
    pointer-events: none; opacity: 0.7;
  }
}

figure.figure figcaption {
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 14px;
  color: var(--ink-muted);
  margin-top: 16px;
  line-height: 1.55;
  font-style: italic;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}
figure.figure figcaption strong {
  color: var(--ink-soft);
  font-style: normal;
  font-weight: 500;
  font-variation-settings: "opsz" 14, "wght" 500;
}

/* Interactive figure hover targets */
.hov-target { cursor: pointer; transition: opacity .15s ease; }
.hov-target:hover { opacity: 0.78; }

/* Mini-diagrams for verb conventions etc. */
.verb-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 14px; align-items: center;
  padding: 11px 14px;
  border-radius: 3px;
  margin-bottom: 6px;
  transition: background .15s ease;
}
.verb-row.must {
  background: rgba(177, 74, 22, 0.08);
  border-left: 3px solid var(--accent);
}
.verb-row.will {
  background: rgba(53, 57, 64, 0.04);
  border-left: 3px solid var(--ink-muted);
}
.verb-row.soft {
  background: rgba(208, 200, 181, 0.20);
  border-left: 3px solid var(--line);
}
.verb-row .vtag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.verb-row .vlbl {
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.verb-row .vlbl strong { color: var(--ink); }

/* iPhone safe-area insets */
@supports (padding: max(0px)) {
  .main {
    padding-left: max(72px, env(safe-area-inset-left));
    padding-right: max(72px, env(safe-area-inset-right));
  }
  @media (max-width: 900px) {
    .main {
      padding-left: max(22px, env(safe-area-inset-left));
      padding-right: max(22px, env(safe-area-inset-right));
      padding-bottom: max(80px, env(safe-area-inset-bottom));
    }
  }
}

/* ============================================================
   Real-World Application — refined editorial dossier style
   ============================================================ */
.realworld {
  margin-top: 44px;
  padding: 32px 32px 28px;
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.realworld::before {
  content: "";
  position: absolute;
  top: -1px; bottom: -1px; left: -1px;
  width: 5px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  border-radius: 4px 0 0 4px;
}
.realworld::after {
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 28px; height: 28px;
  border-top: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
}
.realworld .rw-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
  font-weight: 500;
}
.realworld .rw-tag::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--accent-soft) 0%, transparent 100%);
  max-width: 80px;
}
.realworld h3 {
  font-family: var(--serif);
  font-variation-settings: "opsz" 36, "SOFT" 30;
  font-size: 26px;
  font-weight: 450;
  color: var(--ink);
  margin: 0 0 10px;
  line-height: 1.18;
  letter-spacing: -0.022em;
  text-transform: none;
}
.realworld .rw-lede {
  font-family: var(--serif);
  font-variation-settings: "opsz" 16;
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 24px;
  font-style: italic;
  letter-spacing: -0.005em;
}
.realworld .case {
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 20px 22px;
  margin-bottom: 14px;
  transition: border-color .15s ease, transform .15s ease;
  position: relative;
}
.realworld .case:last-of-type { margin-bottom: 0; }
.realworld .case:hover {
  border-color: var(--ink-faint);
  transform: translateX(2px);
}
.realworld .case .case-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--accent-deep);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-weight: 500;
}
.realworld .case .case-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 22, "SOFT" 40;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.32;
  letter-spacing: -0.015em;
}
.realworld .case .case-body {
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.62;
  letter-spacing: -0.003em;
}
.realworld .case .case-body p { margin: 0 0 10px; }
.realworld .case .case-body p:last-child { margin-bottom: 0; }
.realworld .case .case-body strong { color: var(--ink); font-weight: 550; }
.realworld .case .case-takeaway {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-soft);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.52;
}
.realworld .case .case-takeaway strong {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--accent-deep);
  display: block;
  margin-bottom: 5px;
  text-transform: uppercase;
  font-weight: 600;
}
.realworld .case .case-source {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-muted);
  margin-top: 10px;
  letter-spacing: 0.01em;
  line-height: 1.4;
}

/* Currency note — refined warning */
.currency-note {
  background: var(--warn-bg);
  border-left: 3px solid var(--warn);
  padding: 16px 20px;
  margin: 0 0 22px;
  border-radius: 0 3px 3px 0;
  position: relative;
}
.currency-note .cn-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--warn);
  font-weight: 600;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.currency-note .cn-tag::before { content: "⚠"; font-size: 12px; }
.currency-note .cn-body {
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.currency-note .cn-body strong { color: var(--ink); font-weight: 550; }

/* Mobile real-world tightening */
@media (max-width: 700px) {
  .realworld { padding: 24px 20px 20px; margin-top: 36px; }
  .realworld::before { width: 4px; }
  .realworld .case { padding: 16px 18px; }
  .realworld h3 { font-size: 22px; }
  .realworld .rw-lede { font-size: 15px; }
  .realworld .case .case-body { font-size: 14.5px; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .sidebar, .chapter-footer, .quiz-actions { display: none; }
  .app { grid-template-columns: 1fr; }
  .main { padding: 0; max-width: none; }
  html { background: white; background-image: none; }
  .main > * { animation: none; }
}

/* ============================================================
   Practice Exercises — learn by doing.
   Placed after Real-World Application, before Key Terms.
   Four types: scenario, sequence, calculate, draft.
   ============================================================ */
.exercises {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.exercises > .ex-section-header {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 22px;
}
.exercises > .ex-section-header h2 {
  margin: 0; padding: 0;
}
.exercises > .ex-section-header h2::before { content: none; }
.exercises > .ex-section-header .ex-count {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.exercises > .ex-intro {
  font-family: var(--serif);
  font-variation-settings: "opsz" 16;
  font-size: 16px;
  color: var(--ink-soft);
  font-style: italic;
  margin: 0 0 26px;
  line-height: 1.55;
}

/* Individual exercise card */
.exercise {
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 24px 28px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
@media (max-width: 700px) { .exercise { padding: 18px 18px 16px; } }

.exercise .ex-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  gap: 14px;
  flex-wrap: wrap;
}
.exercise .ex-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.exercise .ex-tag::before {
  content: "";
  display: inline-block;
  width: 12px; height: 1px;
  background: var(--accent);
}
.exercise .ex-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.exercise .ex-title {
  font-family: var(--serif);
  font-variation-settings: "opsz" 24, "SOFT" 40;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0 0 14px;
  text-transform: none;
}
.exercise .ex-prompt {
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin-bottom: 18px;
  letter-spacing: -0.003em;
}
.exercise .ex-prompt p { margin: 0 0 10px; }
.exercise .ex-prompt p:last-child { margin-bottom: 0; }
.exercise .ex-prompt code,
.exercise .ex-prompt pre {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--paper);
  color: var(--accent-deep);
  border-radius: 2px;
}
.exercise .ex-prompt code { padding: 1px 6px; }
.exercise .ex-prompt pre {
  display: block;
  padding: 12px 14px;
  margin: 12px 0;
  white-space: pre-wrap;
  border-left: 2px solid var(--accent);
  background: var(--paper);
  color: var(--ink-soft);
  line-height: 1.55;
}
.exercise .ex-prompt strong { color: var(--ink); font-weight: 550; }
.exercise .ex-prompt em { font-style: italic; color: var(--accent-deep); }

/* Scenario / multiple-choice options (reuse .opt logic but distinct visual) */
.exercise .ex-options {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 6px;
}
.exercise .ex-opt {
  text-align: left;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  display: flex; gap: 12px; align-items: flex-start;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
  background-image: none;
}
.exercise .ex-opt:hover:not(:disabled) {
  background: var(--paper);
  border-color: var(--ink-muted);
  transform: translateX(2px);
}
.exercise .ex-opt:disabled { cursor: default; transform: none; }
.exercise .ex-opt .ex-letter {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-muted);
  min-width: 18px;
  padding-top: 1px;
  font-weight: 500;
}
.exercise .ex-opt.correct {
  background: var(--good-bg); border-color: var(--good);
  animation: pulse-good .4s ease;
}
.exercise .ex-opt.correct .ex-letter { color: var(--good); font-weight: 600; }
.exercise .ex-opt.incorrect {
  background: var(--bad-bg); border-color: var(--bad);
  animation: pulse-bad .4s ease;
}
.exercise .ex-opt.incorrect .ex-letter { color: var(--bad); font-weight: 600; }
.exercise .ex-opt.faded { opacity: 0.55; transform: none; }

/* Sequence type */
.exercise .ex-sequence {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 14px;
}
.exercise .ex-seq-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 14.5px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
  background-image: none;
}
.exercise .ex-seq-item:hover:not(.placed) {
  background: var(--paper);
  border-color: var(--ink-muted);
}
.exercise .ex-seq-item.placed { opacity: 0.5; cursor: default; pointer-events: none; }
.exercise .ex-seq-item .ex-seq-badge {
  display: inline-flex; justify-content: center; align-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper-3);
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  color: var(--ink-muted);
  flex-shrink: 0;
}
.exercise .ex-seq-item.placed .ex-seq-badge {
  background: var(--accent); border-color: var(--accent); color: white;
}
.exercise .ex-seq-item.correct {
  background: var(--good-bg); border-color: var(--good); opacity: 1;
}
.exercise .ex-seq-item.correct .ex-seq-badge { background: var(--good); border-color: var(--good); color: white; }
.exercise .ex-seq-item.incorrect {
  background: var(--bad-bg); border-color: var(--bad); opacity: 1;
}
.exercise .ex-seq-item.incorrect .ex-seq-badge { background: var(--bad); border-color: var(--bad); color: white; }
.exercise .ex-seq-item .ex-seq-correct {
  margin-left: auto;
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}
.exercise .ex-seq-item.incorrect .ex-seq-correct { color: var(--bad); }

/* Calculate type */
.exercise .ex-calc {
  display: flex; flex-direction: column; gap: 10px;
}
.exercise .ex-calc-input-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.exercise .ex-calc-prefix,
.exercise .ex-calc-suffix {
  font-family: var(--mono); font-size: 14px; color: var(--ink-muted); font-weight: 500;
}
.exercise .ex-calc input[type="text"],
.exercise .ex-calc input[type="number"] {
  font-family: var(--mono);
  font-size: 15px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 3px;
  color: var(--ink);
  width: 200px;
  max-width: 100%;
  letter-spacing: 0.01em;
  transition: border-color .15s ease;
}
.exercise .ex-calc input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--paper-3);
}
.exercise .ex-calc-hint {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-muted);
  font-style: italic;
}

/* Draft type */
.exercise .ex-draft textarea {
  width: 100%;
  min-height: 120px;
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 15px;
  line-height: 1.55;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 3px;
  color: var(--ink-soft);
  resize: vertical;
  transition: border-color .15s ease;
}
.exercise .ex-draft textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--paper-3);
}
.exercise .ex-draft-hint {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-muted);
  font-style: italic;
  margin-bottom: 10px;
}

/* Action bar (Check / Reveal / Reset buttons) */
.exercise .ex-actions {
  display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap;
}
.exercise .ex-btn {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  font-variation-settings: "wght" 520;
  padding: 9px 18px;
  border-radius: 3px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-3);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.exercise .ex-btn:hover {
  background: var(--accent-deep); border-color: var(--accent-deep);
  transform: translateY(-1px);
}
.exercise .ex-btn.secondary {
  background: transparent; color: var(--ink); border-color: var(--line);
}
.exercise .ex-btn.secondary:hover {
  background: var(--paper-3); color: var(--accent-deep); border-color: var(--accent-deep);
}
.exercise .ex-btn:disabled {
  opacity: 0.4; cursor: not-allowed; transform: none;
}
@media (max-width: 700px) {
  .exercise .ex-btn { padding: 12px 18px; min-height: 44px; }
}

/* Feedback / reveal area */
.exercise .ex-feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 2px solid var(--accent);
  background: var(--paper);
  border-radius: 0 3px 3px 0;
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-soft);
  animation: rise .35s ease backwards;
}
.exercise .ex-feedback strong { color: var(--ink); }
.exercise .ex-feedback.success { border-left-color: var(--good); }
.exercise .ex-feedback.warn { border-left-color: var(--warn); background: var(--warn-bg); }

.exercise .ex-feedback-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}
.exercise .ex-feedback.success .ex-feedback-label { color: var(--good); }

/* Draft model answer + rubric */
.exercise .ex-model {
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 16px 18px;
  margin-top: 14px;
  animation: rise .35s ease backwards;
}
.exercise .ex-model-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 600;
  margin-bottom: 8px;
}
.exercise .ex-model-body {
  font-family: var(--serif);
  font-variation-settings: "opsz" 14;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--ink-soft);
}
.exercise .ex-model-body p { margin: 0 0 8px; }
.exercise .ex-model-body p:last-child { margin: 0; }
.exercise .ex-rubric {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.exercise .ex-rubric-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}
.exercise .ex-rubric ul {
  margin: 0; padding-left: 18px;
  list-style: none;
}
.exercise .ex-rubric li {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-bottom: 6px;
  position: relative;
  padding-left: 4px;
}
.exercise .ex-rubric li::before {
  content: "✓";
  position: absolute;
  left: -18px;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 600;
}


/* ============================================================
   Workspace cross-app nav strip — injected by shared.js
   ============================================================ */
.ws-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 18px;
  background: var(--paper-3);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 200;
}
.ws-strip a {
  color: var(--ink-muted);
  text-decoration: none;
  padding: 4px 0;
  transition: color 0.15s ease;
}
.ws-strip a:hover { color: var(--accent-deep); }
.ws-strip .ws-home {
  color: var(--ink);
  font-weight: 600;
}
.ws-strip .ws-home::before {
  content: "\2190";
  margin-right: 6px;
  color: var(--accent);
}
.ws-strip .ws-apps {
  display: flex;
  gap: 14px;
  align-items: center;
}
.ws-strip .ws-apps .ws-current {
  color: var(--accent);
  font-weight: 600;
  position: relative;
}
.ws-strip .ws-apps .ws-current::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--accent);
}
.ws-strip .ws-sep { color: var(--ink-faint); opacity: 0.55; }
@media (max-width: 520px) {
  .ws-strip { padding: 6px 12px; font-size: 9.5px; letter-spacing: 0.1em; }
  .ws-strip .ws-apps { gap: 10px; }
  .ws-strip .ws-sep { display: none; }
}
