:root { --ink: var(--text); --teal: #157774; }
html[data-theme="dark"] { --teal: #79d2c6; }
body { min-height: 100vh; display: flex; flex-direction: column; }
#main { flex: 1; min-width: 0; }
#main:focus { outline: none; }
.skip { position: fixed; z-index: 40; top: 6px; left: 8px; padding: 8px 16px; background: var(--surface); transform: translateY(-150%); }
.skip:focus { transform: none; }

/* Shared mathematical plots in lessons, previews and simulations. */
.chapter-case-figure > canvas, .case-page-figure > canvas { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; }
.chart-card { margin: 0; min-width: 0; padding: 12px 12px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--plot); }
.chart-card h3 { margin: 2px 4px; line-height: 1.4; font-size: 16px; color: var(--accent2); }
.chart-card canvas { width: 100%; height: clamp(214px, 32vw, 310px); display: block; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; padding: 3px 4px; color: var(--muted); font-size: 13px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 16px; height: 3px; border-radius: 2px; background: var(--series-color); }
.chart-legend:empty { display: none; }

/* Directory, simulations index, and books use the same course-page frame. */
.course-aux-head { padding: clamp(20px, 3.4vw, 48px); }
.course-aux-head p { margin: 12px 0 0; color: var(--muted); }
.course-aux-group { margin-top: 24px; }
.course-aux-group > h2 { margin: 0 0 10px; font-size: 23px; color: var(--accent2); }
.course-aux-rows { display: grid; gap: 10px; }
.course-aux-rows > .case-card { max-width: none; }
.course-aux-end { margin-top: 24px; }
.course-aux-group p, .course-aux-group li { color: var(--muted); }
.course-aux-group .quiet-link { white-space: normal; }
.course-aux-group .course-page-end { margin-top: 10px; }

html.course-lesson[data-theme="light"] body { background: #f2f5f8; }
