:root {
  color-scheme: light;
  --paper: #f7f6f0;
  --surface: #fffef9;
  --ink: #212a24;
  --muted: #56635a;
  --line: #ddded2;
  --accent: #24523f;
  --wash: #e5eee4;
  --display: "STIX Two Text", Georgia, serif;
  font-family: "Inter", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.frame { width: min(100% - 3rem, 76rem); margin-inline: auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row, .account { display: flex; align-items: center; gap: 1.2rem; }
.header-row { justify-content: space-between; min-height: 4.1rem; }
.brand { display: flex; gap: .65rem; align-items: center; font: 600 1.3rem var(--display); text-decoration: none; }
.brand span { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; background: var(--accent); border-radius: .55rem; color: white; font-size: 1.5rem; }
.account { font-size: .875rem; }
.account button { border: 0; background: none; padding: .3rem 0; color: var(--accent); }
.account button:hover { text-decoration: underline; }
.intro { padding: 3rem 0 1.8rem; }
h1, h2, h3, p { margin: 0; }
h1, h2, .course-card strong { font-family: var(--display); }
h1 { font-size: clamp(2.2rem, 5vw, 4rem); letter-spacing: -.035em; line-height: 1.05; font-weight: 600; }
h2 { font-size: 1.65rem; font-weight: 600; }
.intro p, .muted { color: var(--muted); }
.intro p { margin-top: .85rem; }
.subject { padding-bottom: 2rem; }
.course-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 24rem)); margin-top: 1rem; }
.course-card { display: grid; gap: .65rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: .85rem; text-decoration: none; color: var(--ink); }
.course-card:hover { border-color: var(--accent); }
.course-card strong { font-size: 1.6rem; line-height: 1.15; }
.course-card > span { color: var(--muted); }
.course-card .course-symbol { width: 2.55rem; padding: .25rem .4rem; margin-bottom: .25rem; text-align: center; border-radius: .5rem; background: var(--wash); color: var(--accent); font: 1.55rem var(--display); }
.course-card .card-action { margin-top: .7rem; font-size: .88rem; font-weight: 600; color: var(--accent); }
.crumbs { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; padding-top: 1.4rem; font-size: .87rem; color: var(--muted); }
.crumbs > * + *::before { content: "/"; margin-right: .45rem; color: var(--muted); }
.crumbs + .intro { padding-top: 2rem; }
.button, .primary { display: inline-block; padding: .6rem .9rem; border-radius: .45rem; text-decoration: none; border: 1px solid var(--accent); font-size: .9rem; }
.button { margin-top: 1.1rem; }
.button:hover { background: var(--wash); }
.primary { background: var(--accent); color: white; }
.contents { max-width: 53rem; padding-bottom: 3rem; }
.chapter-card { margin-top: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: .7rem; overflow: hidden; }
.chapter-card h3 { display: flex; gap: .6rem; align-items: baseline; padding: .85rem 1rem; font-size: 1rem; }
.chapter-number, .section-number, .page-number { font-variant-numeric: tabular-nums; color: var(--muted); }
.chapter-card ul, .outline ul { margin: 0; padding: 0; list-style: none; }
.chapter-card li a { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: .55rem; padding: .68rem 1rem; border-top: 1px solid var(--line); text-decoration: none; }
.chapter-card li a:hover { background: var(--wash); }
.reader { display: grid; grid-template-columns: minmax(14rem, 17rem) minmax(0, 1fr); align-items: start; gap: clamp(1.2rem, 4vw, 3rem); padding-top: 1.6rem; padding-bottom: 2rem; }
.outline { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: .7rem; padding: .85rem; }
.outline summary { font-weight: 650; cursor: pointer; }
.outline h2 { padding: .95rem .15rem .3rem; color: var(--muted); font: 600 .85rem/1.35 "Inter", "Segoe UI", sans-serif; }
.outline li a { display: grid; grid-template-columns: 1.85rem 1fr; gap: .3rem; padding: .4rem .35rem; font-size: .82rem; line-height: 1.35; text-decoration: none; border-radius: .3rem; }
.outline li a:hover, .outline li a[aria-current] { background: var(--wash); }
.outline li a[aria-current] { font-weight: 650; }
.lesson-intro { padding: 0 0 1.2rem; }
.lesson-intro h1 { font-size: clamp(1.95rem, 4vw, 3.35rem); }
.lesson-intro .location { margin: 0 0 .5rem; font-size: .88rem; }
.modes { display: flex; flex-wrap: wrap; gap: .28rem; padding: .25rem; margin-bottom: 1rem; width: fit-content; border-radius: .6rem; border: 1px solid var(--line); background: var(--surface); }
.modes a { text-decoration: none; padding: .48rem .7rem; border-radius: .4rem; font-size: .92rem; }
.modes a:hover { background: var(--wash); }
.modes a[aria-current] { background: var(--accent); color: white; }
.source, .prose, .empty, .login-card { background: var(--surface); border: 1px solid var(--line); border-radius: .7rem; }
.source { overflow: hidden; }
.source-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: .7rem 1rem; font-size: .9rem; }
.source iframe { display: block; width: 100%; height: min(74vh, 53rem); min-height: 22rem; border: 0; background: var(--wash); }
.prose { padding: clamp(1rem, 3vw, 2.3rem); line-height: 1.7; overflow-wrap: anywhere; }
.prose > * + * { margin-top: .9rem; }
.prose h2 { line-height: 1.2; }
.prose h2:not(:first-child) { margin-top: 1.8rem; }
.prose h3 { font-size: 1.05rem; margin-top: 1.25rem; }
.prose .math.block { overflow-x: auto; }
.empty { padding: 1.2rem; }
.page-nav { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: space-between; margin-top: 1.2rem; font-size: .86rem; }
.page-nav .next { margin-left: auto; }
.login-card { max-width: 25rem; padding: 1.7rem; margin: 4rem auto; }
.login-card h1 { font-size: 2.6rem; }
.login-card p { margin: 1rem 0; }
.login-card label { display: block; margin-bottom: .3rem; }
.login-card input:not([type=hidden]) { width: 100%; padding: .55rem; border-radius: .35rem; border: 1px solid var(--muted); }
.errorlist { color: #8c2931; }
.notices { list-style: none; padding: .8rem 1rem; margin: 1rem 0 0; background: var(--wash); border-radius: .45rem; }
.report-link { font-size: .85rem; margin-top: .85rem; }
.panel { border: 1px solid var(--line); border-radius: .7rem; background: var(--surface); padding: 1.15rem; }
.edit-form { max-width: 42rem; margin-bottom: 2rem; }
.edit-form p { margin: 0 0 1rem; }
.edit-form label { display: block; margin-bottom: .35rem; }
.edit-form input, .edit-form textarea, .login-card select { background: white; color: var(--ink); border: 1px solid var(--muted); border-radius: .35rem; width: 100%; padding: .55rem; font: inherit; }
.edit-form textarea { resize: vertical; }
.form-actions, .complaint-footer { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; }
.login-card .helptext { display: block; margin-top: .35rem; font-size: .78rem; color: var(--muted); }
.login-card .helptext ul, .login-card form > ul:not(.errorlist) { padding-left: 1.15rem; font-size: .78rem; color: var(--muted); }
.manage-list { display: grid; gap: .75rem; padding-bottom: 1rem; max-width: 55rem; }
.account-card { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .75rem; }
.account-info { min-width: 0; overflow-wrap: anywhere; }
.account-card h2, .complaint-card h2 { font-size: 1.35rem; }
.account-card p, .complaint-footer { font-size: .85rem; margin-top: .35rem; }
.account-card .ban-note { color: #8c2931; }
.minor-button, .danger { display: inline-block; padding: .6rem .9rem; border-radius: .4rem; font-size: .875rem; text-decoration: none; }
.minor-button { border: 1px solid var(--line); }
.minor-button:hover { background: var(--wash); }
.danger { background: #8c2931; color: white; border: 1px solid #8c2931; }
.complaint-card { display: grid; gap: .6rem; overflow-wrap: anywhere; }
.complaint-card p { font-size: .9rem; }
.complaint-text { white-space: pre-wrap; }
.complaint-footer { justify-content: space-between; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding-bottom: 1.5rem; }
@media (max-width: 48rem) {
  .frame { width: min(100% - 2rem, 76rem); }
  .reader { grid-template-columns: minmax(0, 1fr); }
  .outline { position: static; max-height: 11rem; }
}
@media (max-width: 24rem) {
  .frame { width: calc(100% - 1rem); }
  .header-row, .account { gap: .6rem; }
  .modes a { padding-inline: .4rem; }
}
