:root {
  --ink: #443522;
  --muted: #796b5b;
  --paper: #fffdf8;
  --bg: #f7efe3;
  --line: #e8d9c4;
  --accent: #885e30;
  --mint: #eaf3e7;
  --bad: #a8332e;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  overflow: hidden;
  margin: 0;
}
body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 18px;
  display: flex;
  flex-direction: column;
}
button,
input,
select {
  font: inherit;
  min-height: 44px;
  min-width: 44px;
}
button,
select {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  padding: 9px 14px;
  cursor: pointer;
}
button:hover {
  border-color: var(--accent);
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #b77c32;
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
header {
  flex: none;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}
.brand h1 {
  font-size: 18px;
  margin: 0;
  flex: 1;
}
#sections {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 12px;
}
#sections button {
  font-size: 16px;
  padding: 8px;
}
.active,
.primary {
  background: var(--accent) !important;
  color: #fff !important;
}
main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  padding: 28px 20px;
  overscroll-behavior: contain;
}
article {
  max-width: 1000px;
  margin: auto;
}
h2 {
  font-size: 30px;
  margin: 8px 0 20px;
}
h3 {
  font-size: 22px;
}
p {
  line-height: 1.7;
}
footer {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--paper);
  border-top: 1px solid var(--line);
}
#jump {
  max-width: 300px;
  min-width: 0;
  width: 26vw;
}
#pos {
  white-space: nowrap;
  font-size: 16px;
}
.card,
fieldset,
.material {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  margin: 18px 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.eyebrow {
  color: var(--muted);
  font-size: 16px;
}
.cover {
  padding: 36px 0;
}
.cover h2 {
  font-size: 42px;
  max-width: 760px;
}
.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chip {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 8px 14px;
  font-size: 16px;
}
.rich {
  line-height: 1.75;
  overflow-wrap: anywhere;
}
.rich p {
  margin: 10px 0;
}
.rich ul,
.rich ol {
  padding-left: 24px;
}
.table-wrap {
  width: 100%;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 17px;
}
td,
th {
  padding: 10px;
  border: 1px solid var(--line);
  text-align: left;
  overflow-wrap: anywhere;
}
th {
  background: #f4e8d5;
}
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  margin: 8px 0;
  min-height: 48px;
  cursor: pointer;
}
.option:has(input:checked) {
  background: #f7e7ce;
  border-color: var(--accent);
}
input[type="radio"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  accent-color: var(--accent);
}
input[type="text"] {
  border: 1px solid #b9a58b;
  border-radius: 8px;
  padding: 10px;
  max-width: 100%;
  width: 280px;
}
.blank {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 8px 0;
}
.feedback {
  border-left: 4px solid var(--bad);
  background: #fff0eb;
  padding: 16px;
  margin-top: 16px;
}
.feedback.correct {
  border-color: #447946;
  background: #eef6e9;
}
.score {
  font-size: 24px;
  font-weight: 700;
}
.teacher {
  border: 1px solid #c68e32;
  background: #fff1ca;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 14px 0;
}
.badge {
  display: inline-block;
  font-size: 16px;
  background: #f6d78e;
  padding: 4px 10px;
  border-radius: 20px;
}
.worked {
  border-left: 4px solid #bd9a65;
  padding-left: 18px;
  margin: 20px 0;
}
.worked details {
  margin: 10px 0;
}
.worked summary {
  cursor: pointer;
  min-height: 44px;
  padding: 10px;
}
u {
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}
.arrow {
  display: inline-flex;
  vertical-align: middle;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  margin: 0 5px;
}
.arrow small {
  font-size: 0.65em;
}
dialog {
  max-width: 90vw;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  color: var(--ink);
}
dialog::backdrop {
  background: #0006;
}
#toast {
  position: fixed;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  padding: 14px;
  background: #443522;
  color: #fff;
  border-radius: 12px;
  z-index: 99;
  max-width: 90vw;
}
[hidden] {
  display: none !important;
}
a {
  color: #75501f;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.summary-grid .card {
  margin: 0;
}
.toc {
  display: grid;
  gap: 10px;
}
.toc button {
  text-align: left;
}
.empty {
  color: var(--muted);
}
@media (max-width: 600px) {
  header {
    padding: 8px 10px;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
  .brand h1 {
    font-size: 16px;
  }
  #sections {
    gap: 4px;
    margin-top: 8px;
  }
  #sections button {
    font-size: 16px;
    padding: 6px 2px;
    border-radius: 8px;
  }
  main {
    padding: 16px 12px;
  }
  h2 {
    font-size: 26px;
  }
  .cover {
    padding: 12px 0;
  }
  .cover h2 {
    font-size: 32px;
  }
  .card,
  fieldset,
  .material {
    padding: 16px;
    border-radius: 14px;
  }
  footer {
    gap: 8px;
    padding: 8px;
  }
  footer .extra,
  #jump {
    display: none;
  }
  footer button {
    flex: 1;
    padding: 9px 6px;
  }
  #pos {
    min-width: 64px;
    text-align: center;
  }
  .summary-grid {
    grid-template-columns: 1fr;
  }
  table {
    font-size: 16px;
  }
  td,
  th {
    padding: 6px;
  }
  .brand button {
    font-size: 16px;
    padding: 7px;
  }
  .rich {
    font-size: 17px;
  }
}
#score {
  position: static;
  background: #f5ecd9;
  padding: 12px 18px;
  box-shadow: 0 2px 8px #44352212;
}
dialog {
  max-height: 85vh;
  overflow: auto;
}
body {
  font-family:
    system-ui,
    -apple-system,
    "PingFang SC",
    "Noto Sans",
    "Segoe UI Symbol",
    sans-serif;
}
#kp-progress {
  font-size: 15px;
  color: var(--muted);
  margin: 6px 0 0;
}
#menu {
  width: min(880px, 94vw);
  padding: 24px;
}
#menu h2 {
  margin-top: 0;
}
.menu-actions {
  position: sticky;
  top: -24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--paper);
  padding: 10px 0;
  z-index: 3;
}
.menu-path {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.unit-nav {
  margin: 18px 0;
}
.unit-nav > summary {
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  padding: 14px;
  background: #efe3cf;
  border-radius: 12px;
  min-height: 48px;
}
.unit-nav .toc {
  margin-top: 10px;
}
.kp-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.nav-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.nav-meta .chip {
  font-size: 14px;
  padding: 3px 8px;
}
.nav-state {
  font-size: 15px;
  color: #497044;
}
.needs-review {
  color: var(--bad);
}
.self-reference {
  padding: 16px;
  background: #f3ecd9;
  border-radius: 12px;
  margin: 12px 0;
}
.table-wrap {
  overscroll-behavior-x: contain;
}
.worked details[open] {
  padding-bottom: 8px;
}
footer button {
  font-size: 16px;
}
@media (max-width: 600px) {
  #menu {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    padding: 16px;
  }
  .menu-actions {
    top: -16px;
  }
  .kp-nav-item {
    align-items: flex-start;
    flex-direction: column;
  }
  .nav-meta {
    justify-content: space-between;
    width: 100%;
  }
  #sections button {
    font-size: 16px;
  }
  .rich table {
    min-width: 480px;
  }
  #kp-progress {
    font-size: 14px;
    margin: 4px 0;
  }
  .worked {
    margin-left: 0;
    padding-left: 12px;
  }
}
.unit-nav .toc {
  max-height: none;
  overflow: visible;
  padding: 3px;
}
.unit-nav {
  margin: 12px 0;
}
.unit-nav > summary {
  font-size: 18px;
}
.table-wrap:focus-visible {
  outline: 2px solid var(--accent);
}

.school-focus {
  display: inline-block;
  border: 1px solid #b99250;
  background: #fff0c7;
  color: #76521c;
  font-size: 14px;
  border-radius: 18px;
  padding: 4px 9px;
  white-space: nowrap;
}
.nav-meta {
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .unit-nav .toc {
    max-height: none;
  }
  .unit-nav {
    margin: 8px 0;
  }
  .unit-nav > summary {
    padding: 10px;
  }
}

#menu {
  scroll-padding-top: 90px;
}
.kp-nav-item {
  scroll-margin-top: 90px;
}
.optional-badge {
  background: #e9f0ec;
  color: #345942;
}
.optional-note {
  border-left: 4px solid #91aa97;
  padding: 12px 16px;
  margin: 12px 0;
  background: #f4f8f2;
}
/* Claude UI review: semantic feedback, compact chrome, accessible controls. */
:root {
  --muted: #6b5a48;
  --success: #2e7d32;
  --success-bg: #eaf5eb;
  --bad: #c62828;
  --error-bg: #fdecec;
  --teacher: #1f5fad;
  --teacher-bg: #e8f0fb;
}
article {
  max-width: 800px;
}
:fullscreen article,
:-webkit-full-screen article {
  max-width: 1000px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.short-label {
  display: none;
}
.brand h1 {
  min-width: 0;
}
.progress-track {
  height: 4px;
  background: var(--line);
  margin-top: 8px;
  border-radius: 4px;
  overflow: hidden;
}
#overall-progress {
  height: 100%;
  background: var(--accent);
  transition: width 0.2s;
}
.question-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 15px;
}
.question-heading > b {
  background: #f4e8d5;
  color: var(--accent);
  padding: 4px 9px;
  border-radius: 6px;
}
.question-state {
  color: var(--muted);
}
.option-correct,
.option-correct:has(input:checked) {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}
.option-wrong,
.option-wrong:has(input:checked) {
  border-color: var(--bad);
  background: var(--error-bg);
  color: var(--bad);
}
.option-muted {
  opacity: 0.55;
}
.option-mark {
  margin-left: auto;
  font-size: 14px;
  flex-shrink: 0;
}
.option > span {
  min-width: 0;
}
.option {
  flex-wrap: wrap;
}
.feedback {
  background: var(--error-bg);
}
.feedback.correct {
  background: var(--success-bg);
  border-color: var(--success);
}
.answer-right {
  color: var(--success);
}
.answer-wrong {
  color: var(--bad);
}
.blank > span {
  flex: 0 0 auto;
  white-space: nowrap;
}
.blank input {
  flex: 1;
  min-width: 0;
  width: 100%;
  font-size: 16px;
}
.blank input.input-correct {
  border: 2px solid var(--success);
  color: var(--success);
}
.blank input.input-wrong {
  border: 2px solid var(--bad);
  color: var(--bad);
}
input:disabled {
  opacity: 1;
  -webkit-text-fill-color: currentColor;
}
fieldset #submit {
  margin-top: 12px;
}
.teacher {
  border: 1px solid var(--teacher);
  border-left: 4px solid var(--teacher);
  background: var(--teacher-bg);
  margin-top: 24px;
}
.teacher h3 {
  font-size: 20px;
  margin: 4px 0;
  color: var(--teacher);
}
.teacher button {
  border-color: var(--teacher);
  color: var(--teacher);
}
.teacher-hint,
.teacher-tag {
  color: var(--teacher);
  font-size: 14px;
}
.teacher-tag {
  background: var(--teacher-bg);
  padding: 4px 8px;
  border-radius: 12px;
}
.teacher-summary button {
  border-left: 4px solid var(--teacher);
}
.mistake {
  background: var(--error-bg);
  border-left: 4px solid var(--bad);
  padding: 14px 18px;
  border-radius: 10px;
  margin: 18px 0;
}
.mistake > strong {
  color: var(--bad);
}
.cover {
  padding: 0;
}
.cover > p {
  margin: 12px 0;
}
.cover-start {
  min-height: 48px;
}
.cover details {
  margin-top: 18px;
}
.cover details > summary {
  min-height: 44px;
  cursor: pointer;
}
.worked .example-prompt {
  background: var(--paper);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 600;
}
.worked summary {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f2e7d6;
  border-radius: 8px;
  list-style: none;
}
.worked summary::-webkit-details-marker {
  display: none;
}
.worked summary:before {
  content: "▸";
}
.worked details[open] > summary:before {
  content: "▾";
}
.worked summary:hover,
.worked summary:active {
  background: #e8d8bd;
}
.worked summary small {
  margin-left: auto;
  color: var(--muted);
}
.when-open {
  display: none;
}
.worked details[open] .when-open {
  display: inline;
}
.worked details[open] .when-closed {
  display: none;
}
.expand-all {
  border: 0;
  background: transparent;
  text-decoration: underline;
  font-size: 15px;
}
.table-shell {
  position: relative;
  min-width: 0;
}
.table-wrap {
  -webkit-overflow-scrolling: touch;
}
.table-shell.more-right:after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  top: 42px;
  width: 22px;
  background: linear-gradient(90deg, transparent, #44352235);
  pointer-events: none;
}
.table-hint {
  font-size: 14px;
  color: var(--muted);
  margin: 4px 0;
}
td,
th {
  min-width: 6em;
}
td:first-child,
th:first-child {
  position: sticky;
  left: 0;
  background: var(--paper);
  z-index: 1;
}
th:first-child {
  background: #f4e8d5;
}
.nav-state {
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}
.nav-state.is-right {
  color: var(--success);
}
.nav-state.needs-review {
  color: var(--bad);
}
.kp-nav-item.current {
  border-left: 3px solid var(--accent);
  background: #f6ead8;
}
.nav-meta {
  justify-content: flex-start;
  gap: 6px;
}
.danger-link {
  color: var(--bad);
  border: 0;
  background: transparent;
  margin-top: 24px;
}
.danger {
  background: var(--bad);
  color: white;
}
.menu-actions {
  justify-content: flex-end;
}
.unanswered-focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.unit-complete {
  background: var(--success-bg);
  border-color: var(--success);
}
@media (max-width: 600px) {
  .nav-meta {
    justify-content: flex-start;
    gap: 6px;
  }
  #menu-fullscreen {
    display: none;
  }
  .rich {
    font-size: 16px;
  }
  h2 {
    font-size: 22px;
  }
}
@media (max-width: 480px) {
  header {
    padding: 0 10px 4px;
  }
  .brand {
    height: 44px;
    gap: 8px;
  }
  .brand img {
    width: 24px;
    height: 24px;
  }
  .brand h1 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand button {
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    font-size: 14px;
  }
  #kp-progress {
    display: none;
  }
  #sections {
    margin-top: 2px;
    gap: 4px;
  }
  #sections button {
    height: 34px;
    min-height: 34px;
    font-size: 14px;
    white-space: nowrap;
    padding: 4px 2px;
  }
  .long-label {
    display: none;
  }
  .short-label {
    display: inline;
  }
  .progress-track {
    margin-top: 4px;
  }
  body {
    font-size: 16px;
  }
  #pos {
    font-size: 14px;
    min-width: 75px;
  }
}

.menu-actions {
  align-items: center;
  flex-wrap: nowrap;
}
.menu-actions h2 {
  font-size: 24px;
  margin: 0 auto 0 0;
}

/* Approved horizontal wordmark; preserve its intrinsic ratio. */
.brand img {
  height: 38px;
  width: auto;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .brand img {
    height: 29px;
    width: auto;
  }
}
