:root {
  color-scheme: light;
  --bg: #f1f1f1;
  --surface: #ffffff;
  --panel: #f7f9fb;
  --panel-strong: #eef2f6;
  --text: #171717;
  --muted: #5d6670;
  --border: #d7dadd;
  --border-strong: #aeb4ba;
  --accent: #0d6efd;
  --accent-hover: #0a58ca;
  --accent-soft: #eaf3ff;
  --success: #198754;
  --success-hover: #146c43;
  --danger: #dc3545;
  --danger-hover: #b02a37;
  --warning: #d99a00;
  --warning-hover: #b78000;
  --secondary: #747d85;
  --secondary-hover: #5e666d;
  --code: #090909;
  --radius: 7px;
  --shadow: 0 1px 4px rgb(0 0 0 / 7%);
  --shadow-raised: 0 3px 14px rgb(31 91 143 / 16%);
  --course-footer-link-size: calc(.68rem + 2pt);
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); min-width: 320px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
a { color: var(--accent); text-decoration: none; }
button, textarea, input, select { font: inherit; }
button { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid rgb(13 110 253 / 45%); outline-offset: 2px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.app-shell { width: min(1218px, 100%); margin: 0 auto; background: var(--surface); border: 1px solid #65a8e8; border-radius: 8px; box-shadow: var(--shadow-raised); overflow: hidden; }
.course-header { display: grid; grid-template-columns: minmax(160px, .8fr) minmax(180px, .9fr) minmax(250px, 1.25fr) auto; align-items: center; gap: 22px; padding: 18px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.brand-block { color: var(--text); min-width: 0; }
.brand-block small { display: block; margin-top: 2px; color: var(--muted); font-size: .7rem; }
.brand { color: var(--accent); font-size: 1.35rem; font-weight: 800; letter-spacing: -.05em; }
.icon-button { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: var(--muted); }
.icon-button:hover { background: var(--panel-strong); color: var(--text); }
.user-card { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 10px; min-width: 0; }
.user-card form { margin: 0; }
.user-card strong, .user-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card strong { font-size: .82rem; }
.user-card small { color: var(--muted); font-size: .68rem; margin-top: 2px; }
.user-avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--text); color: #fff; font-weight: 800; }
.progress-summary { min-width: 210px; }
.progress-summary > span:first-child { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; }
.progress-summary small { display: block; color: var(--muted); font-size: .68rem; margin-top: 7px; }
.progress-track { height: 3px; display: block; background: var(--border); margin-top: 10px; border-radius: 999px; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .25s; }
.header-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.header-tools > a:not(.button) { display: inline-flex; align-items: center; justify-content: center; height: 24px; padding: 0 9px; border: 1px solid var(--accent); border-radius: 4px; color: var(--accent); background: var(--surface); font-size: .72rem; font-weight: 700; }
.header-tools > a:not(.button):hover { color: #fff; background: var(--accent); }
.header-tools form { margin: 0; }
main { min-width: 0; }
#app { min-width: 0; }
.course-footer { display: flex; justify-content: space-between; gap: 20px; padding: 13px 22px; border-top: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: .68rem; }

.dashboard { padding: 20px 28px 46px; }
.dashboard-heading { margin-bottom: 12px; }
.lesson-number.dashboard-summary { display: block; font-size: calc(.7rem + 2pt); font-weight: 700; }
.dashboard-summary strong { color: var(--text); font-family: inherit; font-weight: 700; letter-spacing: normal; text-transform: none; }
.chapter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.chapter-card { display: flex; flex-direction: column; min-width: 0; min-height: 272px; padding: 18px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.chapter-card.complete { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.chapter-card.guest-locked { border-color: #d4d4d4; background: #f3f3f3; box-shadow: none; filter: grayscale(1); }
.chapter-card.guest-locked h2,
.chapter-card.guest-locked .chapter-description,
.chapter-card.guest-locked .chapter-index { color: #777; }
.chapter-card.guest-locked .chapter-select { color: #777; background: #e8e8e8; border-color: #ccc; cursor: not-allowed; }
.chapter-card.guest-locked .chapter-open:disabled { color: #777; background: #ddd; border-color: #bbb; opacity: 1; }
.chapter-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chapter-index { color: var(--accent); font: 700 .67rem ui-monospace, monospace; letter-spacing: .1em; }
.chapter-status { color: var(--muted); font-size: .67rem; }
.chapter-status.done { color: var(--success); font-weight: 700; }
.chapter-status.locked { color: #666; font-weight: 700; }
.chapter-card h2 { margin: 12px 0 7px; font-size: 1.05rem; line-height: 1.25; letter-spacing: -.025em; }
.chapter-description { margin: 0 0 16px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.chapter-progress { margin-top: auto; }
.chapter-progress > span:first-child { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .68rem; }
.chapter-progress .progress-track { margin: 7px 0 13px; }
.chapter-progress .progress-track span { width: var(--chapter-progress); }
.chapter-select { width: 100%; min-height: 36px; padding: 7px 30px 7px 9px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--text); font-size: .75rem; text-overflow: ellipsis; }
.chapter-select:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
.button.primary.chapter-open { width: 100%; margin-top: 9px; color: var(--accent); background: var(--surface); border-color: var(--accent); }
.button.primary.chapter-open:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
h1, h2, h3 { letter-spacing: -.045em; }
.eyebrow { color: var(--muted); font: .72rem ui-monospace, monospace; margin-bottom: 20px; }
.actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; border: 1px solid transparent; border-radius: 4px; padding: 7px 15px; color: #fff; background: var(--secondary); cursor: pointer; font-weight: 700; transition: background-color .15s, border-color .15s, box-shadow .15s; }
.button:hover { background: var(--secondary-hover); box-shadow: 0 2px 7px rgb(0 0 0 / 14%); }
.button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.button.danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.guest-locked-view { max-width: 620px; margin: 0 auto; }
.guest-locked-view p { max-width: 560px; line-height: 1.65; }
.guest-lock-icon { display: grid; width: 52px; height: 52px; place-items: center; border-radius: 50%; color: #666; background: #e2e2e2; font-size: 1.35rem; }

.lesson, .progress-page, .glossary-page, .schema-page { max-width: 900px; padding: 42px 48px 72px; margin: 0 auto; }
.view-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 28px; color: var(--muted); font-size: var(--course-footer-link-size); }
.view-back:hover { color: var(--accent); }
.view-back.compact { margin: 0 8px 0 0; }
.lesson-meta-row { display: flex; align-items: center; gap: 24px; margin-bottom: 28px; }
.lesson-meta-row .view-back { margin: 0 0 0 auto; color: var(--accent); font-size: var(--course-footer-link-size); text-decoration: none; white-space: nowrap; }
.lesson-meta-row .view-back:hover { color: var(--accent); text-decoration: underline; }
.empty-view { min-height: 430px; display: grid; place-content: center; justify-items: center; padding: 40px 20px; text-align: center; }
.empty-view h1 { margin-bottom: 4px; }
.empty-view p { margin-bottom: 24px; color: var(--muted); }
.lesson-number { font: .7rem ui-monospace, monospace; color: var(--accent); letter-spacing: .12em; }
.lesson-context { display: block; text-align: left; font-size: calc(.7rem + 4pt); font-weight: 700; white-space: nowrap; }
.lesson h1 { font-size: 1.75rem; margin: 8px 0 24px; }
.progress-page h1, .glossary-page h1 { font-size: clamp(2rem, 4.5vw, 3.15rem); margin: 8px 0 24px; }
.lead { color: var(--muted); font-size: 1.08rem; line-height: 1.75; }
.lesson h2 { font-size: 1.25rem; margin: 48px 0 14px; }
.lesson p, .lesson li { line-height: 1.75; font-size: 1rem; }
.key-points { margin: 18px 0 0; padding-left: 1.35rem; }
.key-points li + li { margin-top: 5px; }
.code-block { position: relative; background: var(--code); color: #f8f8f2; padding: 18px 20px; border-radius: var(--radius); overflow: auto; font: .9rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; }
.engine-note, .common-mistake { margin: 14px 0 0; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.common-mistake { border-left-color: var(--warning); }
.schema-shortcut { margin-top: 18px; padding: 12px 14px; border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--panel); }
.example-reading { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--radius); background: var(--panel); }
.concept-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 26px 0; }
.concept-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--surface); box-shadow: var(--shadow); }
.concept-card strong { display: block; font: .82rem ui-monospace, monospace; margin-bottom: 8px; }
.concept-card span { color: var(--muted); font-size: .88rem; line-height: 1.5; }
.exercise { margin-top: 52px; border: 1px solid #65a8e8; border-radius: 8px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-raised); }
.exercise-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; background: var(--panel); border-bottom: 1px solid var(--border); }
.exercise-head h3 { margin: 0; }
.exercise-head > div { display: grid; width: 100%; gap: 5px; }
.exercise-head > div .lesson-number { font-weight: 700; }
.editor { min-height: 155px; width: 100%; border: 0; resize: vertical; background: #101010; color: #f8f8f2; padding: 20px; outline: none; font: .92rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
.exercise-actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #222; background: #101010; }
.exercise-actions .button { color: #fff; background: var(--secondary); border-color: transparent; padding: 7px 13px; font-size: .82rem; }
.exercise-actions .button:hover { background: var(--secondary-hover); }
.exercise-actions #run-lesson { background: var(--accent); }
.exercise-actions #run-lesson:hover { background: var(--accent-hover); }
.exercise-actions #show-solution { background: var(--warning); }
.exercise-actions #show-solution:hover { background: var(--warning-hover); }
.result { min-height: 72px; padding: 16px; border-top: 1px solid var(--border); overflow: auto; }
.result.empty { color: var(--muted); font-size: .86rem; }
.result table { width: 100%; border-collapse: collapse; font: .78rem ui-monospace, monospace; }
.result th, .result td { border: 1px solid var(--border); text-align: left; padding: 9px; white-space: nowrap; }
.result th { color: var(--text); background: var(--panel-strong); }
.feedback { padding: 11px 16px; font-size: .86rem; background: var(--accent-soft); }
.feedback.success { color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.feedback.warning { color: var(--text); background: color-mix(in srgb, var(--warning) 16%, var(--surface)); }
.feedback.hint { color: var(--text); }
.lesson-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 42px; }
.optional-challenge { margin-top: 22px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.optional-challenge summary { color: var(--accent); font-weight: 700; cursor: pointer; }
.optional-challenge p { margin-bottom: 8px; }
.lesson-nav .button,
.lesson-nav .button.primary { height: 24px; min-height: 0; padding: 0 9px; border-color: var(--accent); color: var(--accent); background: var(--surface); font-size: .72rem; font-weight: 700; box-shadow: none; }
.lesson-nav .button:hover,
.lesson-nav .button.primary:hover { border-color: var(--accent); color: #fff; background: var(--accent); box-shadow: none; }

.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 24px 0 36px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat strong { font-size: 1.8rem; display: block; }
.stat span { color: var(--muted); font-size: .82rem; }
.module-list { display: grid; gap: 10px; }
.module { display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface); box-shadow: var(--shadow); }
.module-index { font: .8rem ui-monospace, monospace; color: var(--accent); }
.module p { margin: 3px 0 0; color: var(--muted); font-size: .84rem; }
.module-status { font: .72rem ui-monospace, monospace; color: var(--muted); }
.progress-actions { margin-top: 28px; }

.playground-page { height: 680px; min-height: 560px; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.pg-toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel); }
.pg-toolbar h1 { font: 700 1rem ui-monospace, monospace; margin: 0 auto 0 0; }
.pg-help { color: var(--muted); font-size: .72rem; margin-right: 8px; }
.pg-grid { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr); min-height: 0; }
.pg-pane { min-height: 0; display: grid; grid-template-rows: auto 1fr; }
.pg-pane + .pg-pane { border-left: 1px solid var(--border); }
.pane-label { padding: 10px 14px; border-bottom: 1px solid var(--border); font: .68rem ui-monospace, monospace; color: var(--muted); letter-spacing: .08em; }
.pg-editor { width: 100%; height: 100%; border: 0; resize: none; background: #101010; color: #fff; padding: 22px; outline: none; font: .92rem/1.7 ui-monospace, monospace; }
.pg-results { overflow: auto; padding: 16px; }

.exam-page { max-width: 800px; margin: 0 auto; padding: 42px 48px 72px; }
.exam-page h1 { font-size: 1.75rem; margin: 8px 0 24px; }
.question { margin: 18px 0; padding: 12px 16px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.question legend { font-weight: 700; padding: 0 5px; }
.option { display: flex; gap: 10px; padding: 4px 0; color: var(--muted); }
.option input { accent-color: var(--accent); }
.exam-result { margin-top: 16px; padding: 16px; border-radius: var(--radius); background: var(--panel); }
.exam-result.passed { border-left: 3px solid var(--success); }
.exam-result.failed { border-left: 3px solid var(--warning); }
.exam-review { display: grid; gap: 10px; margin: 14px 0 0; padding-left: 1.3rem; }
.exam-review li { padding: 8px 10px; border-radius: var(--radius); background: var(--surface); }
.exam-review li.correct { border-left: 3px solid var(--success); }
.exam-review li.incorrect { border-left: 3px solid var(--warning); }
.exam-review a { display: inline-block; margin-left: 4px; }

.relation-map { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.relation-map span { padding: 6px 10px; border-radius: var(--radius); color: #fff; background: var(--accent); font-family: ui-monospace, monospace; }
.relation-map b { color: var(--muted); font-size: .82rem; }
.schema-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.schema-reference { display: flex; flex-direction: column; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.schema-reference p strong, .schema-reference li strong { font-size: inherit; }
.schema-note { margin-top: auto; padding-top: 10px; color: var(--muted); font-size: .9rem; }
.schema-card { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.schema-card h2 { margin: 3px 0 8px; }
.schema-card p { line-height: 1.55; }
.schema-card ul { margin: 8px 0 14px; padding-left: 1.2rem; }
.schema-card li + li { margin-top: 4px; }
.schema-card strong { color: var(--accent); font-size: .72rem; }

.glossary-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.term { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; background: var(--surface); box-shadow: var(--shadow); }
.term dt { font: 700 .9rem ui-monospace, monospace; margin-bottom: 8px; }
.term dd { margin: 0; color: var(--muted); line-height: 1.55; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--text); color: var(--bg); padding: 11px 15px; border-radius: 9px; transform: translateY(120px); opacity: 0; transition: .25s; z-index: 50; }
.toast.show { transform: translateY(0); opacity: 1; }
.auth-body { min-height: 100vh; background: var(--panel); }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 76px 20px 30px; position: relative; }
.auth-brand { position: absolute; top: 26px; left: 30px; }
.auth-card { width: min(440px, 100%); padding: 38px; border: 1px solid #65a8e8; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-raised); text-align: center; }
.auth-symbol { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 1.5rem; }
.auth-card h1 { font-size: 2rem; margin: 8px 0 10px; }
.auth-card > p { color: var(--muted); line-height: 1.55; margin: 0 0 24px; }
.auth-card > small { display: block; color: var(--muted); margin-top: 18px; line-height: 1.5; }
.auth-form { display: grid; gap: 8px; text-align: left; }
.auth-form label { font-size: .78rem; font-weight: 700; margin-top: 8px; }
.auth-form input { width: 100%; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); color: var(--text); padding: 10px 12px; outline: none; }
.auth-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-form .button { margin-top: 14px; }
.auth-error { padding: 11px 13px; margin-bottom: 12px; border-radius: 8px; background: #fff0f0; color: var(--danger); font-size: .84rem; text-align: left; }

@media (max-width: 1050px) {
  .course-header { grid-template-columns: minmax(150px, .8fr) minmax(180px, 1fr) auto; }
  .brand-block { display: none; }
  .chapter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { background: var(--surface); }
  .app-shell { border: 0; border-radius: 0; box-shadow: none; }
  .course-header { grid-template-columns: 1fr auto; gap: 14px; padding: 14px 16px; }
  .progress-summary { grid-column: 1 / -1; grid-row: 2; }
  .header-tools > a:not(.continue-link) { display: none; }
  .dashboard { padding: 18px 18px 38px; }
  .chapter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson, .progress-page, .glossary-page, .schema-page { padding: 42px 22px 80px; }
  .lesson-meta-row { flex-wrap: wrap; gap: 12px 24px; }
  .lesson-meta-row .view-back { margin-left: auto; }
  .concept-grid, .stat-row { grid-template-columns: 1fr; }
  .schema-grid { grid-template-columns: 1fr; }
  .relation-map { flex-wrap: wrap; }
  .pg-grid { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .pg-pane + .pg-pane { border-left: 0; border-top: 1px solid var(--border); }
  .pg-toolbar .text-label { display: none; }
  .pg-help { display: none; }
  .glossary-grid { grid-template-columns: 1fr; }
.course-footer { flex-direction: column; gap: 4px; }
}

.course-area-back { margin-left: auto; color: var(--accent); font-size: var(--course-footer-link-size); text-decoration: none; }
.course-area-back:hover { text-decoration: underline; }
.course-index-back { color: var(--accent); font-size: var(--course-footer-link-size); text-decoration: none; }
.course-index-back:hover { text-decoration: underline; }

@media (max-width: 520px) {
  .user-card small { display: none; }
  .header-tools .continue-link { display: none; }
  .course-header { grid-template-columns: 1fr auto; }
  .chapter-grid { grid-template-columns: 1fr; }
  .chapter-card { min-height: 0; }
  .concept-grid { grid-template-columns: 1fr; }
  .lesson-nav { flex-direction: column; }
  .lesson-nav .button { width: 100%; }
}

.book-dashboard .dashboard-heading h1 { margin: .45rem 0; font-size: clamp(1.125rem, 3vw, 1.75rem); }
.book-dashboard .dashboard-heading p { max-width: none; line-height: 1.65; }
.book-dashboard .chapter-card { display: flex; flex-direction: column; gap: .75rem; }
.book-dashboard .chapter-card .button { align-self: flex-start; margin-top: auto; }
.book-page { max-width: 1100px; margin: 0 auto; padding: 2rem 1.4rem 4rem; }
.book-back { display: inline-block; margin-bottom: 1.5rem; }
.book-heading { margin-bottom: 1.7rem; }
.book-heading h1 { margin: .45rem 0 .6rem; font-size: clamp(1.125rem, 3vw, 1.75rem); line-height: 1.15; }
.book-overview .book-prose h2, .book-page > h2 { font-size: clamp(1.125rem, 2vw, 1.25rem); }
.book-heading p { max-width: none; line-height: 1.65; }
.book-overview, .book-task, .book-work, .book-reveal { margin: 1.35rem 0; padding: 1.35rem 1.5rem; border: 1px solid var(--border, #d5d9df); border-radius: 16px; background: #fff; }
.book-overview summary, .book-reveal summary { cursor: pointer; font-weight: 700; }
.book-overview .book-prose { padding-top: 1rem; }
.book-prose { line-height: 1.7; overflow-wrap: anywhere; }
.book-prose h2, .book-prose h3 { margin: 1.4rem 0 .6rem; }
.book-prose p, .book-prose ol, .book-prose ul { max-width: none; }
.book-page[data-chapter="c01"] .book-overview .book-prose > h2:first-child + p { color: #b91c1c; }
.book-prose pre { padding: 1rem; overflow-x: auto; background: #172231; color: #f7f9fc; border-radius: 10px; }
.book-prose code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.book-prose table, .book-sql-result table { border-collapse: collapse; min-width: max-content; width: 100%; font-size: .94rem; }
.book-prose table { display: block; overflow-x: auto; }
.book-prose th, .book-prose td, .book-sql-result th, .book-sql-result td { padding: .6rem .75rem; border: 1px solid #d6dce4; text-align: left; }
.book-prose th, .book-sql-result th { background: #eef2f6; }
.book-activity-list { display: grid; gap: .7rem; }
.book-activity-link { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border: 1px solid #d5dce4; border-radius: 12px; background: #fff; text-decoration: none; color: inherit; }
a.book-activity-link:hover, a.book-activity-link:focus-visible { border-color: #487aa4; box-shadow: 0 3px 12px #1d36551c; }
.book-activity-type { min-width: 9rem; color: #526579; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.book-activity-link strong { flex: 1; }
.book-activity-link > span:last-child { font-size: .85rem; color: #526579; }
.book-work label { display: block; font-weight: 700; margin: .45rem 0 .6rem; }
.book-work textarea { width: 100%; min-height: 200px; padding: 1rem; border: 1px solid #9aa9b8; border-radius: 10px; font: 1rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; }
.book-work select { max-width: 100%; padding: .65rem; margin-bottom: 1rem; border: 1px solid #9aa9b8; border-radius: 8px; }
.book-help, .book-engine-note { color: #526579; line-height: 1.55; }
.book-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; margin: 1rem 0; }
.book-sql-result { min-height: 1.2rem; margin-top: 1rem; overflow-x: auto; }
.book-sql-result strong { display: inline-block; margin-bottom: .7rem; }
.book-table-wrap { overflow-x: auto; }
.book-sql-result td { white-space: pre-wrap; }
.book-error { color: #a52d2d; }
.book-reveal { border-left: 5px solid #5d83a5; }
.book-reveal[hidden] { display: none; }
.book-reveal details { margin-top: 1.3rem; padding-top: .8rem; border-top: 1px solid #d5dce4; }
.book-neighbors { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: 2rem; }
.book-glossary { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: .75rem 1.2rem; max-width: 800px; }
.book-glossary dt { font-weight: 700; }
.book-glossary dd { margin: 0; }
@media (max-width: 700px) {
  .book-page { padding: 1.2rem .8rem 3rem; }
  .book-overview, .book-task, .book-work, .book-reveal { padding: 1rem; }
  .book-activity-link { align-items: flex-start; flex-direction: column; gap: .35rem; }
  .book-glossary { grid-template-columns: 1fr; }
}
