:root {
  color-scheme: light;
  --paper: #faf9f5;
  --card: #fffefa;
  --ink: #162e2b;
  --mute: #526863;
  --line: #d4dcd4;
  --teal: #155a4b;
  --rail: #183e36;
  --mint: #e4eedf;
  --serif: Georgia, "Times New Roman", serif;
  font:
    16px/1.5 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
*,
*:before,
*:after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
summary,
select {
  cursor: pointer;
}
button,
a,
input,
select,
textarea,
summary {
  outline-offset: 4px;
}
:focus-visible {
  outline: 3px solid #bb7823;
}
button {
  background: none;
  border: 0;
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
a {
  color: var(--teal);
}
button:hover:not(:disabled) {
  filter: brightness(0.91);
}
textarea,
input,
select {
  border: 1px solid #bdcbc1;
  border-radius: 5px;
  background: var(--card);
}
textarea,
input {
  width: 100%;
  padding: 0.65rem 0.8rem;
}
textarea {
  resize: vertical;
  min-height: 4.8rem;
}
select {
  max-width: 100%;
  padding: 0.42rem 0.7rem;
}
label {
  display: block;
  font-weight: 600;
}
small,
.subtle,
.form-hint {
  color: var(--mute);
  font-weight: 400;
}
small {
  display: block;
  font-size: 0.81rem;
  margin-top: 0.28rem;
}
.skip,
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip:focus {
  clip-path: none;
  width: auto;
  height: auto;
  z-index: 10;
  background: #fff;
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 1rem;
}
.layout {
  display: grid;
  grid-template-columns: clamp(205px, 18vw, 274px) minmax(0, 1fr);
  min-height: 100vh;
}
.rail {
  background: var(--rail);
  color: #edf4e9;
  padding: 2.1rem clamp(1.1rem, 2vw, 2.1rem);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.identity {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  font: 2.1rem/1 var(--serif);
  letter-spacing: -0.055em;
}
.mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transform: skew(-18deg);
  height: 1.7rem;
}
.mark i {
  display: block;
  width: 4px;
  height: 1.65rem;
  background: #d9e9cd;
  border-radius: 3px;
}
.mark i:first-child {
  height: 0.8rem;
  align-self: end;
}
.mark i:last-child {
  height: 0.9rem;
  align-self: start;
}
.rail-intro {
  font-size: 0.86rem;
  color: #b4cdbf;
  margin: 0.6rem 0 3rem;
}
.rail-label,
.actions,
.identity-small,
.topline,
.tabs,
.composer-bar,
.section-head,
.run-meta,
.run-footer,
.evidence-heading {
  display: flex;
  align-items: center;
}
.rail-label,
.section-head,
.topline {
  justify-content: space-between;
  gap: 0.7rem;
}
.rail-label {
  border-bottom: 1px solid #45655c;
  padding-bottom: 0.55rem;
}
.rail-label h2,
.example-tag,
.mode,
.status {
  font-size: 0.77rem;
  letter-spacing: 0.045em;
  font-weight: 650;
}
.rail-label h2 {
  text-transform: uppercase;
  color: #c4d6c9;
}
.icon-btn {
  border: 1px solid #688278;
  border-radius: 5px;
  line-height: 1;
  font-size: 1.25rem;
  color: #edf4e9;
  width: 1.65rem;
  height: 1.65rem;
}
#books {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.65rem;
}
.book-item {
  text-align: start;
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  border-radius: 5px;
  padding: 0.52rem 0.55rem;
  color: #d8e5da;
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}
.book-item:before {
  content: "";
  width: 0.65rem;
  height: 0.79rem;
  border: 1px solid currentColor;
  border-left-width: 3px;
  border-radius: 1px;
  flex: none;
  transform: translateY(1px);
}
.book-item[aria-current="page"] {
  background: #34584c;
  color: white;
}
.book-item:hover {
  background: #2c5044;
}
.rail-empty {
  font-size: 0.9rem;
  color: #b3c9bb;
  padding: 0.35rem 0;
}
.rail-form {
  padding: 0.75rem 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.86rem;
}
.rail-form input {
  color: var(--ink);
  font-size: 0.95rem;
}
.rail-submit,
.rail-link {
  font-size: 0.86rem;
  border-radius: 4px;
}
.rail-submit {
  background: #dce8d6;
  color: var(--rail);
  padding: 0.25rem 0.6rem;
}
.rail-link {
  color: #dce8d6;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.25rem 0.3rem;
}
.rail-foot {
  border-top: 1px solid #45655c;
  padding-top: 1.1rem;
  margin-top: auto;
  display: flex;
  align-items: start;
  gap: 0.5rem;
  flex-direction: column;
  font-size: 0.86rem;
}
.identity-small {
  gap: 0.6rem;
  overflow-wrap: anywhere;
}
.user-glyph {
  display: inline-block;
  position: relative;
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border: 1px solid #91b09b;
  border-radius: 100%;
}
.user-glyph:before,
.user-glyph:after {
  content: "";
  position: absolute;
  border: 1px solid #b9cfb7;
}
.user-glyph:before {
  width: 0.4rem;
  height: 0.4rem;
  top: 0.28rem;
  left: 0.53rem;
  border-radius: 100%;
}
.user-glyph:after {
  width: 0.85rem;
  height: 0.43rem;
  left: 0.31rem;
  bottom: 0.26rem;
  border-radius: 1rem 1rem 0.22rem 0.22rem;
}
main {
  width: min(100%, 1100px);
  padding: 0 clamp(1.25rem, 5vw, 5.4rem) 4rem;
  min-width: 0;
}
.topline {
  min-height: 4.7rem;
  border-bottom: 1px solid var(--line);
  color: var(--mute);
  font-size: 0.84rem;
}
.slash {
  color: #9caaa0;
  padding: 0 0.45rem;
}
.mode {
  color: var(--teal);
  padding: 0.16rem 0.55rem;
  background: #edf2e9;
  border: 1px solid #c9d9c8;
  border-radius: 100px;
  white-space: nowrap;
}
.book-header,
.signin {
  padding: 2.5rem 0 1.5rem;
}
.serif-kicker {
  font-style: italic;
  font-family: var(--serif);
  color: var(--teal);
  font-size: 1.15rem;
}
h1,
h2,
h3,
.section-title {
  font-family: var(--serif);
  font-weight: 400;
}
h1 {
  font-size: clamp(2.5rem, 4.5vw, 4.2rem);
  line-height: 1.06;
  letter-spacing: -0.055em;
  margin: 0.34rem 0;
  overflow-wrap: anywhere;
}
.tabs {
  gap: 1.6rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.55rem;
}
.tabs button {
  font-size: 0.95rem;
  color: var(--mute);
  padding: 0.55rem 0 0.64rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs button[aria-selected="true"] {
  border-color: var(--teal);
  font-weight: 650;
  color: var(--teal);
}
.tabs button span {
  font-size: 0.75rem;
  background: #e8ece4;
  padding: 0.09rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.22rem;
}
.composer,
.run-card,
.note-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.composer {
  padding: clamp(1rem, 2.3vw, 1.75rem);
}
.section-title,
.section-head h2 {
  font-size: clamp(1.5rem, 2.1vw, 2rem);
  line-height: 1.18;
  letter-spacing: -0.035em;
}
#question,
#note {
  margin: 0.9rem 0 0.25rem;
  background: #fff;
  border-color: #becbc1;
}
::placeholder {
  color: #708079;
  opacity: 1;
}
.options {
  font-size: 0.9rem;
}
summary {
  width: fit-content;
  color: var(--teal);
  font-weight: 600;
  padding: 0.34rem 0;
}
.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin: 0.9rem 0;
}
.option-grid input {
  font-size: 0.91rem;
  margin-top: 0.25rem;
}
.code-box {
  display: grid;
  gap: 0.5rem;
  margin: 0.4rem 0 0.8rem;
}
.code-box select {
  justify-self: start;
  font-size: 0.87rem;
}
.code-box textarea,
pre {
  font:
    0.87rem/1.55 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
}
.composer-bar {
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 0.65rem;
}
.composer-bar span {
  margin-right: auto;
  color: var(--mute);
  font-size: 0.83rem;
}
.primary {
  background: var(--teal);
  color: white;
  border-radius: 6px;
  padding: 0.62rem 1.05rem;
  font-weight: 600;
  font-size: 0.92rem;
  display: inline-block;
  text-decoration: none;
}
.example {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.4rem;
  margin: 1.25rem 0;
  background: var(--mint);
  border-radius: 9px;
  padding: 1.35rem 1.6rem;
  overflow: hidden;
}
.example-tag {
  font-family: ui-monospace, monospace;
  font-weight: 500;
  color: #3a5d48;
}
.example h2 {
  font-size: clamp(1.45rem, 2.4vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.04em;
  margin: 0.3rem 0;
}
.example p,
.form-hint,
.signin p {
  color: var(--mute);
  margin: 0.35rem 0 0.7rem;
}
.example-link,
.text-btn {
  font-size: 0.89rem;
  color: var(--teal);
  text-decoration: underline;
  text-underline-offset: 4px;
  font-weight: 600;
  padding: 0.15rem 0;
}
.example figure {
  flex: none;
  text-align: center;
}
.example canvas {
  display: block;
  width: 144px;
  height: auto;
  margin: auto;
}
figcaption {
  font:
    0.74rem/1.5 ui-monospace,
    monospace;
  color: #416347;
}
.history {
  margin-top: 2.1rem;
}
.section-head {
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}
.section-head select {
  font-size: 0.89rem;
  min-width: 0;
  max-width: min(100%, 19rem);
}
.run-card,
.note-card {
  padding: clamp(1rem, 2.3vw, 1.75rem);
  overflow-wrap: anywhere;
}
.run-meta {
  gap: 0.7rem;
  color: var(--mute);
  font-size: 0.83rem;
  flex-wrap: wrap;
}
.status {
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  background: #edf0e9;
  color: #3a5549;
}
.status.running,
.status.queued {
  background: #fcf0cc;
  color: #71511a;
}
.status.failed {
  background: #f9e3dc;
  color: #833b32;
}
.status.complete {
  background: #daecdf;
  color: #265138;
}
.run-card h3 {
  font-size: 1.65rem;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0.7rem 0;
}
.run-card h4,
.note-card h3 {
  font-size: 1.06rem;
  font-weight: 620;
  font-family: inherit;
  margin: 0 0 0.4rem;
}
.evidence {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 1rem;
}
.evidence p,
.note-card p,
.digest {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.evidence details {
  margin-top: 0.4rem;
}
pre {
  background: #f0f3ec;
  color: #213b32;
  padding: 0.8rem 1rem;
  border-radius: 5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 24rem;
  overflow: auto;
}
.output-label {
  font-size: 0.85rem;
  color: var(--mute);
  margin: 0.45rem 0;
}
.source-list {
  padding-left: 1.2rem;
}
.source-list li {
  margin: 0.55rem 0;
}
.source-list p {
  font-size: 0.91rem;
  color: var(--mute);
}
.run-footer {
  gap: 1rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 1.1rem;
  padding-top: 0.7rem;
}
.note-card {
  margin: 0.8rem 0;
}
.note-card time {
  font-size: 0.83rem;
  color: var(--mute);
}
.notice {
  padding: 0.8rem 1rem;
  background: #fff1d5;
  border: 1px solid #e3c98c;
  border-radius: 6px;
  margin: 1rem 0;
  white-space: pre-wrap;
}
.empty,
.stage,
#loading {
  color: var(--mute);
  padding: 0.8rem 0;
}
.signin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.signin p {
  max-width: 37rem;
  margin: 1rem 0 1.4rem;
}
@media (min-width: 1500px) {
  main {
    margin: 0 auto;
  }
}
@media (max-width: 840px) {
  .layout {
    grid-template-columns: 180px minmax(0, 1fr);
  }
  main {
    padding-left: 1.35rem;
    padding-right: 1.35rem;
  }
  .rail {
    padding: 1.5rem 1rem;
  }
  .example {
    padding: 1.15rem;
    gap: 0.7rem;
  }
  .example canvas {
    width: 100px;
  }
  .example figcaption {
    max-width: 9rem;
  }
  .option-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 650px) {
  .layout {
    display: block;
  }
  .rail {
    padding: 0.9rem 1.05rem 0.7rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
  }
  .identity {
    font-size: 1.65rem;
  }
  .mark {
    height: 1.25rem;
  }
  .mark i {
    height: 1.25rem;
  }
  .rail-intro {
    display: none;
  }
  .rail-foot {
    grid-row: 1;
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    border: 0;
    padding: 0;
    margin: 0;
  }
  .rail-foot .identity-small {
    display: none;
  }
  .library {
    grid-row: 2;
    grid-column: 1/-1;
  }
  .rail-label {
    border: 0;
    padding: 0;
  }
  .rail-label h2 {
    font-size: 0.72rem;
  }
  .icon-btn {
    width: 1.55rem;
    height: 1.55rem;
  }
  #books {
    display: flex;
    overflow-x: auto;
    margin: 0.25rem 0 0;
  }
  .book-item {
    white-space: nowrap;
  }
  .rail-empty {
    display: none;
  }
  .rail-form {
    max-width: 25rem;
  }
  main {
    padding: 0 1rem 2rem;
  }
  .topline {
    min-height: 3.3rem;
    font-size: 0.8rem;
  }
  .book-header {
    padding: 1.55rem 0 1rem;
  }
  .tabs {
    margin-bottom: 1rem;
  }
  .example {
    align-items: flex-start;
  }
  .example figure {
    align-self: center;
  }
  .example canvas {
    width: 72px;
  }
  .example figcaption {
    max-width: 6rem;
    font-size: 0.68rem;
  }
  .composer-bar {
    gap: 0.4rem;
  }
  .section-head select {
    max-width: 100%;
  }
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0.2rem 0 0.8rem;
}
.pager button {
  color: var(--teal);
  border: 1px solid #a9bdb0;
  background: var(--card);
  padding: 0.32rem 0.66rem;
  border-radius: 4px;
  font-size: 0.88rem;
  font-weight: 600;
}
.pager button:disabled {
  cursor: default;
  opacity: 0.48;
}
.pager span,
.source-credit,
.source-byline,
.signin-guidance {
  color: var(--mute);
  font-size: 0.87rem;
}
.signin .signin-guidance {
  max-width: 34rem;
}
.source-byline {
  font-style: italic;
}
.source-credit {
  margin-top: 0.45rem;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.2rem 0;
}
#tex-help {
  margin: 0.1rem 0 0.4rem;
}
