@font-face {
  font-family: Instrument;
  src: url('./fonts/instrument-sans.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: Plex;
  src: url('./fonts/plex-mono.woff2') format('woff2');
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #fffefa;
  --rail: #f2f1eb;
  --surface: #fffefa;
  --ink: #242521;
  --muted: #62655d;
  --line: #d9d9cf;
  --accent: #a83a20;
  --active: #e8e8de;
  --highlight: #f9e9df;
  --faint: #8c8e82;
  --onaccent: #fffaf7;
  --head: #f8f7f2;
  --mono: Plex, 'Ubuntu Mono', monospace;
  font:
    15px/1.5 Instrument,
    'Ubuntu Sans',
    system-ui,
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #1c1e1b;
  --rail: #22251f;
  --surface: #252822;
  --ink: #f0f0e7;
  --muted: #b1b5a8;
  --line: #42463c;
  --accent: #ec8d68;
  --active: #34382f;
  --highlight: #3c2d24;
  --faint: #939888;
  --onaccent: #221b16;
  --head: #20231e;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
textarea,
select,
input {
  font: inherit;
  color: inherit;
}
button,
a,
select,
input[type='range'] {
  cursor: pointer;
}
button {
  background: transparent;
  border: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button:hover:enabled,
.quiet:hover {
  background: var(--active);
}
button:disabled {
  opacity: 0.42;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.skip {
  position: fixed;
  top: -80px;
  z-index: 20;
  background: var(--paper);
  padding: 12px;
}
.skip:focus {
  top: 2px;
}
.mast {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 36px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: var(--head);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 176px;
}
.brand:hover {
  text-decoration: none;
}
.brand strong {
  font-size: 28px;
  letter-spacing: -1.8px;
  line-height: 1;
  font-weight: 700;
}
.brand img {
  object-fit: contain;
}
.tabs {
  align-self: stretch;
  display: flex;
  gap: 24px;
}
.tabs button {
  position: relative;
  padding: 0 1px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
}
.tabs button:hover {
  background: transparent;
  color: var(--ink);
}
.tabs button[aria-current='page'] {
  color: var(--ink);
}
.tabs button[aria-current='page']:after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--accent);
}
.mastend,
.tools,
.composecontrols,
.composebar,
.dialogfoot,
.sidefoot,
.quiet,
.new,
.primary,
.secondary {
  display: flex;
  align-items: center;
}
.mastend,
.tools {
  margin-left: auto;
  gap: 12px;
}
.github {
  font-size: 13px;
}
.github span {
  color: var(--muted);
}
svg:not(.symbols):not(#dial) {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.icon {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  font-size: 18px;
}
.shell {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  height: calc(100dvh - 64px);
}
aside {
  background: var(--rail);
  border-right: 1px solid var(--line);
  padding: 24px 16px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidehead h2 {
  font-size: 15px;
  font-weight: 650;
  margin: 0 0 14px 4px;
}
.new,
.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 5px;
  gap: 8px;
  font-weight: 550;
  font-size: 14px;
  padding: 9px 12px;
}
.new {
  width: 100%;
}
.filter {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  margin: 18px 3px 9px;
}
.filter svg {
  width: 15px !important;
}
.filter input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 5px 2px;
  font-size: 13px;
}
#sessions {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
#sessions button {
  width: 100%;
  text-align: left;
  padding: 10px 9px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
}
#sessions button span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#sessions button[aria-current='true'] {
  background: var(--active);
  font-weight: 620;
}
#sessions button[aria-current='true']:before {
  content: '';
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: var(--accent);
  flex: none;
}
.nohistory {
  font-size: 13px;
  color: var(--muted);
  padding: 0 5px;
}
.sidefoot {
  gap: 10px;
  padding: 14px 3px 0;
  border-top: 1px solid var(--line);
}
.sidefoot div {
  display: grid;
}
.sidefoot b {
  font-weight: 550;
  font-size: 12px;
}
.sidefoot span {
  color: var(--muted);
  font: 11px var(--mono);
  margin-top: 4px;
}
main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 4px clamp(15px, 3.5vw, 48px);
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
#viewname {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--muted);
}
.tools {
  gap: 3px;
}
#menu,
#closemenu {
  display: none;
}
#chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#stream {
  overflow: auto;
  flex: 1;
  scrollbar-gutter: stable;
}
#messages,
.writing,
.document {
  width: min(100%, 860px);
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 60px);
}
#messages {
  padding-block: 0 12px;
}
#messages:not(:empty) {
  padding-top: 10px;
}
.writing {
  padding-block: 10px 14px;
}
.empty {
  overflow: auto;
}
.empty #stream {
  display: none;
}
.empty .writing {
  margin-block: auto;
  padding-top: 38px;
  padding-bottom: clamp(36px, 7vh, 90px);
}
.kicker,
.mono,
.diagramlabel {
  font: 11px var(--mono);
  color: var(--muted);
}
.kicker {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 16px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(36px, 4vw, 52px);
  letter-spacing: -0.045em;
  line-height: 1.02;
  font-weight: 580;
  margin-bottom: 13px;
}
#welcome > p:last-child,
.dochead > p:last-child,
.document > p,
.document details p,
.hint {
  color: var(--muted);
}
#welcome > p:last-child {
  margin-bottom: 27px;
}
#welcome h1 {
  display: flex;
  align-items: center;
  gap: 0.26em;
}
#welcome h1 img {
  width: 1.12em;
  height: 1.12em;
  flex: none;
}
.message {
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 10px;
}
.message:last-child {
  border: 0;
}
.message header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-weight: 680;
  font-size: 13px;
  margin-bottom: 7px;
}
.message header small {
  font: 10px var(--mono);
  color: var(--muted);
  font-weight: 400;
}
.message.assistant header:before {
  content: '';
  display: inline-block;
  align-self: center;
  width: 5px;
  height: 12px;
  background: var(--accent);
  margin-right: -5px;
}
.message .body {
  overflow-wrap: anywhere;
  line-height: 1.65;
}
.message .body p {
  margin: 0;
  white-space: pre-wrap;
}
.message pre {
  background: var(--rail);
  border: 1px solid var(--line);
  padding: 12px;
  overflow-x: auto;
  white-space: pre;
  font: 13px/1.55 var(--mono);
}
.message.hit,
.message:target {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}
.source {
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
}
#composer {
  border: 1px solid var(--faint);
  background: var(--surface);
  border-radius: 7px;
  padding: 12px 13px;
}
#composer:focus-within {
  border-color: var(--ink);
}
#draft {
  width: 100%;
  background: none;
  border: 0;
  resize: vertical;
  min-height: 50px;
  max-height: 22vh;
  line-height: 1.5;
  padding: 4px;
  font-size: 16px;
}
#draft:focus {
  outline: 0;
}
.composebar,
.statusline,
.dialogfoot {
  justify-content: space-between;
  gap: 10px;
}
.composecontrols {
  gap: 7px;
}
.quiet,
.secondary,
.primary,
.danger {
  border-radius: 4px;
  padding: 7px 11px;
  gap: 7px;
  font-size: 13px;
  font-weight: 550;
}
.composecontrols select {
  border: 0;
  background: transparent;
  font-size: 13px;
  padding: 7px 3px;
}
.primary,
#send:hover:enabled {
  background: var(--accent);
  color: var(--onaccent);
  border: 1px solid var(--accent);
  justify-content: center;
}
.primary:hover:enabled {
  filter: brightness(0.93);
  background: var(--accent);
}
.primary svg {
  width: 15px !important;
  height: 15px !important;
}
.statusline {
  display: flex;
  align-items: baseline;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
  min-height: 20px;
}
.statusline .mono {
  white-space: nowrap;
  font-size: 10px;
}
#emptylinks {
  border-top: 1px solid var(--line);
  margin-top: 32px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
#emptylinks a {
  padding: 14px 0;
  display: grid;
  gap: 2px;
}
#emptylinks b {
  font-weight: 590;
  font-size: 13px;
}
#emptylinks span {
  color: var(--muted);
  font-size: 12px;
}
#quotechip {
  margin-bottom: 7px;
  border-left: 3px solid var(--accent);
  padding: 2px 8px;
  font-size: 12px;
}
#quotechip button {
  margin-left: 8px;
}
.document {
  overflow: auto;
  padding-top: 36px;
  padding-bottom: 60px;
}
.dochead {
  margin-bottom: 28px;
}
.dochead p:last-child {
  max-width: 68ch;
}
.document h2,
dialog h2 {
  font-size: 23px;
  font-weight: 590;
  letter-spacing: -0.04em;
  margin-bottom: 10px;
}
.document details {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}
.document summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}
.document details p {
  margin: 10px 0 4px;
}
.figure {
  background: var(--rail);
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 16px 0 25px;
  padding: 12px 16px;
}
.figure #dial {
  width: 100%;
  display: block;
  max-height: 252px;
}
.trace-prediction {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.trace-prediction p { font-size: 13px; color: var(--muted); }
#pieceOdds { margin: 0; padding: 0; }
#pieceOdds li { display: grid; grid-template-columns: minmax(4rem, 8rem) minmax(4rem, 12rem) 5rem; gap: 10px; align-items: center; margin: 5px 0; font: 12px var(--mono); }
#pieceOdds code { padding: 0; overflow-wrap: anywhere; }
#pieceOdds meter { width: 100%; height: .75rem; }
#pieceOdds span { text-align: end; }
.training-stages { padding-left: 1.4rem; max-width: 68ch; }
.training-stages li { margin: .65rem 0; padding-left: .2rem; }
.wire {
  stroke: var(--faint);
  stroke-width: 1.2;
}
.litwire {
  stroke: var(--accent);
  stroke-width: 4;
}
.node rect {
  fill: var(--surface);
  stroke: var(--line);
}
.litnode rect {
  fill: var(--accent);
}
.node text,
.litnode text {
  text-anchor: middle;
  font: 14px var(--mono);
  fill: var(--ink);
}
.litnode text {
  fill: var(--onaccent);
}
.diagramlabel text {
  fill: var(--muted);
  font-size: 11px;
}
.controls,
.knobs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.controls label,
.knobs label {
  font-size: 12px;
  font-weight: 550;
}
.controls output,
.knobs output {
  float: right;
  font: 11px var(--mono);
}
input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}
#route {
  font: 12px var(--mono);
  margin: 8px 0 0;
  color: var(--muted);
}
.doclinks {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.doclinks a,
.film a {
  font-size: 13px;
  color: var(--accent);
  text-decoration: underline;
}
.film {
  margin-bottom: 28px;
}
.film video {
  width: 100%;
  background: #23251f;
  border-radius: 5px;
}
.film div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 13px;
}
.film b {
  font-weight: 560;
}
.downloadmain {
  border-block: 1px solid var(--line);
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 20px 0;
  margin-bottom: 13px;
}
.appicon {
  width: 66px;
  height: 66px;
  background: var(--rail);
  display: grid;
  place-items: center;
  border-radius: 12px;
}
.appicon img {
  width: 49px;
  height: 49px;
  object-fit: contain;
}
.downloadmain h2,
.downloadmain p {
  margin: 0;
}
.downloadmain p {
  font-size: 13px;
  color: var(--muted);
}
.downloadmain .primary {
  margin-left: auto;
}
.filelist a {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.filelist span,
.filelist small {
  color: var(--muted);
  font-size: 13px;
}
.filelist strong {
  font: 14px var(--mono);
}
.document code {
  display: block;
  overflow-wrap: anywhere;
  font: 12px/1.65 var(--mono);
  margin-top: 9px;
}
dialog {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 8px;
  padding: 22px;
  width: min(500px, 93vw);
  max-height: 86dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #14161066;
}
.dialogtitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.dialogtitle h2 {
  margin: 0;
}
dialog label {
  display: block;
  font-size: 13px;
  font-weight: 580;
}
dialog textarea,
dialog input[type='text'],
dialog input[type='search'],
dialog input[type='number'] {
  width: 100%;
  margin: 5px 0 8px;
  border: 1px solid var(--faint);
  border-radius: 4px;
  background: var(--paper);
  padding: 8px 9px;
}
.hint {
  font-size: 12px;
  margin: 0 0 17px;
}
.knobs {
  grid-template-columns: 1fr 1fr;
}
.knobs label:last-child {
  grid-column: 1/-1;
}
.knobs input[type='number'] {
  width: 90px;
  margin-left: 15px;
}
.check {
  font-weight: 450;
  margin: 8px 0;
}
.check input {
  accent-color: var(--accent);
}
.dialogfoot {
  margin-top: 18px;
}
.matchrow {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border-top: 1px solid var(--line);
}
.matchrow button {
  text-align: left;
  padding: 11px 4px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.matchrow .attach {
  color: var(--accent);
}
#matches {
  margin-top: 9px;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}
.danger {
  color: var(--accent);
}
#shade {
  display: none;
}
@media (max-width: 800px) {
  .shell {
    grid-template-columns: 188px minmax(0, 1fr);
  }
  .mast {
    gap: 22px;
    padding-inline: 17px;
  }
  .brand {
    min-width: 150px;
  }
  .tabs {
    gap: 15px;
  }
}
@media (max-width: 650px) {
  .mast {
    height: 56px;
    gap: 14px;
    padding: 0 10px;
  }
  .brand {
    min-width: 0;
    gap: 5px;
    flex-shrink: 0;
  }
  .brand img {
    width: 27px;
    height: 29px;
  }
  .brand strong {
    font-size: 22px;
  }
  .tabs {
    gap: 10px;
  }
  .tabs button {
    font-size: 12px;
  }
  .mastend {
    gap: 0;
  }
  .github {
    display: none;
  }
  .icon {
    width: 35px;
    height: 38px;
  }
  .shell {
    height: calc(100dvh - 56px);
    grid-template-columns: minmax(0, 1fr);
  }
  #sidebar {
    display: none;
    position: fixed;
    z-index: 7;
    inset: 56px auto 0 0;
    width: min(84vw, 290px);
  }
  body.menu #sidebar {
    display: flex;
  }
  body.menu #shade {
    display: block;
    position: fixed;
    inset: 56px 0 0;
    background: #10140e70;
    z-index: 6;
    border-radius: 0;
  }
  .toolbar {
    min-height: 44px;
    padding: 2px 10px;
  }
  #menu,
  #closemenu {
    display: inline-grid;
  }
  #chat.empty .writing {
    padding-block: 28px;
  }
  #messages,
  .writing,
  .document {
    padding-inline: 16px;
  }
  .controls {
    gap: 7px;
  }
  .controls label {
    font-size: 11px;
  }
  #emptylinks {
    gap: 10px;
    margin-top: 20px;
  }
  .downloadmain {
    flex-wrap: wrap;
  }
  .downloadmain .primary {
    margin-left: 0;
  }
  .mastend .icon {
    width: 28px;
  }
  .statusline {
    align-items: flex-start;
  }
  .document {
    padding-block: 26px 40px;
  }
  .sidehead h2 {
    margin-bottom: 0;
  }
  .sidehead {
    margin-bottom: 12px;
  }
  .check,
  .quiet,
  .new,
  .tabs button,
  .composecontrols select,
  .primary {
    min-height: 42px;
  }
}
@media (max-width: 390px) {
  .brand strong {
    display: none;
  }
  .brand img {
    width: 30px;
    height: 30px;
  }
}
@media (max-width: 365px) {
  .tabs {
    gap: 7px;
  }
  .mast {
    gap: 8px;
  }
  #welcome h1 {
    font-size: 30px;
  }
  #emptylinks {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .statusline {
    flex-wrap: wrap;
    gap: 0 8px;
  }
}

.contextinfo {
  margin: 10px 0 0;
  font: 11px/1.6 var(--mono);
  color: var(--muted);
}
.contextinfo summary {
  cursor: pointer;
  width: fit-content;
}
.contextinfo span {
  margin-right: 5px;
}
.contextinfo button {
  font: inherit;
  text-decoration: underline;
  color: var(--accent);
  padding: 2px 5px;
}

.message header .pin {
  margin-left: auto;
  font: 11px var(--mono);
  padding: 3px 7px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 3px;
}
.message header .pin[aria-pressed='true'] {
  color: var(--accent);
  border-color: var(--line);
}
@media (hover: hover) {
  .message:not(:hover):not(:focus-within) .pin[aria-pressed='false'] {
    opacity: 0;
  }
}

#readingForm > label:not(:first-of-type) { margin-top: 1rem; }
#readingForm .dialogfoot { justify-content: end; }
#readingForm textarea { resize: vertical; min-height: 6rem; max-height: 40vh; }
.sourcepassage { margin: .65rem 0; font-size: .92rem; }
.sourcepassage summary { cursor: pointer; color: var(--muted); }
.sourcepassage p { white-space: pre-wrap; overflow-wrap: anywhere; }
.sourcepassage mark { background: #f3cb83; color: #38280b; padding: .06em .12em; }
.message blockquote { margin: .5em 0; padding: .15em .9em; border-left: 3px solid var(--accent); white-space: pre-wrap; }
@media (max-width: 520px) {
  #readerOpen { padding-inline: 7px; }
  #readerOpen span { display: none; }
}
.token-explorer { border-bottom: 1px solid var(--line); padding: .4rem 0 .9rem; }
.token-explorer > label { font-size: .86rem; font-weight: 650; }
.trace-input { display: flex; gap: .45rem; margin-block: .35rem .75rem; }
.trace-input input, .trace-input select { color: var(--ink); background: var(--paper); border: 1px solid var(--faint); border-radius: 4px; padding: .4rem .5rem; }
.trace-input input { flex: 1; min-width: 0; }
#tracePieces { display: flex; flex-wrap: wrap; gap: .2rem; }
#tracePieces button { font: .84rem var(--mono); line-height: 1.5; padding: .12rem .35rem; border: 1px solid var(--line); border-radius: 3px; }
#tracePieces .trace-control { color: var(--muted); border-style: dashed; }
#tracePieces [aria-pressed='true'] { border-color: var(--accent); background: var(--highlight); color: var(--ink); }
#traceInfo { font: .77rem var(--mono); color: var(--muted); margin: .7rem 0 0; }
@media (max-width: 560px) {
  #dial .node text, #dial .litnode text { font-size: 22px; }
  #dial .diagramlabel text { font-size: 15px; }
  .figure .controls { align-items: end; }
}
