@font-face {
  font-family: "Instrument Sans";
  src: url("Sans.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400 700;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("Mono.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("Serif.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}
:root {
  color-scheme: light;
  --bg: #f7f3e8;
  --ink: #263b31;
  --muted: #526457;
  --accent: #38634c;
  --surface: #fffefa;
  --line: #e2e1d2;
  --heading: "Instrument Serif", serif;
  --button-ink: #fff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: "Instrument Sans", Arial, sans-serif;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
}
a {
  color: inherit;
  text-underline-offset: 4px;
}
header,
main,
footer {
  width: min(1280px, 100%);
  margin: auto;
  padding-inline: 32px;
}
header {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-size: 1.04rem;
}
.brand img {
  width: 36px;
  height: 36px;
}
nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 0.81rem;
  color: var(--muted);
}
nav a {
  text-decoration: none;
}
nav a:hover {
  text-decoration: underline;
}
nav .repo {
  border: 1px solid var(--line);
  padding: 8px 13px;
  border-radius: 5px;
  color: var(--ink);
}
.masthead {
  display: grid;
  align-items: center;
  min-width: 0;
}
.intro {
  min-width: 0;
}
.category {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.17em;
  color: var(--accent);
  margin: 0 0 16px;
}
h1 {
  font-family: var(--heading);
  font-weight: 700;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.description {
  font-size: 1.02rem;
  max-width: 57ch;
  color: var(--muted);
  margin: 0;
}
.scene {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.scene img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.scene.diagram img {
  object-fit: contain;
}
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  scroll-margin-top: 20px;
  min-width: 0;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 25px;
  min-width: 0;
  border-radius: 12px;
}
h2 {
  font-size: 1.18rem;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0 0 22px;
}
.fields,
.inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}
.wide {
  grid-column: 1/-1;
}
label {
  display: grid;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 0;
}
label.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
}
input,
textarea,
select {
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 100%;
  padding: 11px 12px;
  min-height: 44px;
  min-width: 0;
}
textarea,
pre,
code {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.76rem;
}
textarea {
  resize: vertical;
  line-height: 1.7;
  min-height: 120px;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}
::placeholder {
  color: var(--muted);
  opacity: 0.8;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
button,
.button,
.download {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.45;
  cursor: pointer;
  min-height: 44px;
  background: var(--accent);
  color: var(--button-ink);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  transition:
    background 0.18s,
    transform 0.18s;
}
button:hover,
.button:hover,
.download:hover {
  filter: brightness(0.95);
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.55;
  cursor: progress;
}
button.quiet,
.quiet,
.download {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}
.note,
small {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.65;
  display: block;
  margin: 16px 0 0;
}
.result {
  overflow-wrap: anywhere;
  font-size: 0.88rem;
  min-width: 0;
}
.result > p:first-child {
  font-weight: 600;
  line-height: 1.6;
  margin: 0 0 18px;
}
.result-summary {
  color: var(--accent);
  font-size: 1.02rem;
}
.result > .download,
.result > .button,
.result > button {
  margin-top: 16px;
  margin-right: 7px;
  font-size: 0.75rem;
  max-width: 100%;
}
.grid,
.table-wrap {
  overflow: auto;
  max-height: 480px;
  min-width: 0;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 5px;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.77rem;
  font-variant-numeric: tabular-nums;
}
th,
td {
  text-align: left;
  vertical-align: top;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}
th {
  position: sticky;
  top: 0;
  background: var(--bg);
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
}
td:first-child {
  min-width: 65px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 330px;
  overflow: auto;
}
.result figure {
  margin: 15px 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 4px;
}
figcaption {
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.bar {
  display: grid;
  grid-template-columns: minmax(50px, 1fr) minmax(70px, 1.5fr) 55px;
  gap: 10px;
  align-items: center;
  font-size: 0.74rem;
  margin: 9px 0;
}
meter {
  width: 100%;
  height: 17px;
  accent-color: var(--accent);
}
meter::-webkit-meter-optimum-value {
  background: var(--accent);
}
details {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
summary {
  font-size: 0.81rem;
  font-weight: 600;
  cursor: pointer;
}
details label {
  margin-top: 12px;
}
.guide {
  margin: 26px 0 0;
  background: transparent;
}
.guide ol {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.8;
  padding-left: 22px;
  max-width: 85ch;
}
footer {
  padding-block: 25px 32px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 0.73rem;
  flex-wrap: wrap;
}
footer .credits {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  background: var(--ink);
  color: var(--bg);
  padding: 12px;
  z-index: 10;
}
.skip:focus {
  top: 10px;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.editor-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
  color: var(--muted);
}
.editor-tools button {
  font-size: 0.7rem;
  padding: 5px 9px;
  min-height: 34px;
}
.editor-tools a {
  color: var(--accent);
}
.result-status {
  font-size: 0.71rem;
  color: var(--muted);
  margin: 0 0 17px;
}
.panel:has(.result) h2 {
  margin-bottom: 8px;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Project layout */
.masthead {
  grid-template-columns: 1.1fr 1fr;
  gap: 60px;
  padding: 40px 0;
}
.masthead h1 {
  font-size: clamp(3.4rem, 6.5vw, 6rem);
  font-weight: 400;
}
.masthead .scene {
  height: 260px;
  border-radius: 90px 90px 8px 8px;
}
.workspace {
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 32px;
}
.panel {
  border-radius: 3px;
}
.panel:last-child {
  background: repeating-linear-gradient(
    var(--surface),
    var(--surface) 47px,
    var(--line) 48px,
    var(--surface) 49px
  );
  min-height: 320px;
}
.tasks {
  padding: 0;
  list-style: none;
}
.tasks li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.tasks li input:not([type="checkbox"]) {
  border: none;
  background: transparent;
  padding: 5px;
}
.tasks li button {
  font-size: 0.75rem;
}
.tasks li:has(input:checked) input:not([type="checkbox"]) {
  text-decoration: line-through;
  color: var(--muted);
}

@media (max-width: 900px) {
  header,
  main,
  footer {
    padding-inline: 24px;
  }
  .masthead {
    gap: 25px;
  }
  .masthead h1 {
    font-size: clamp(2.8rem, 6vw, 4.6rem);
  }
  nav {
    gap: 16px;
  }
}
@media (max-width: 700px) {
  header,
  main,
  footer {
    padding-inline: 18px;
  }
  header {
    min-height: 74px;
    gap: 12px;
  }
  .brand {
    font-size: 0.89rem;
    gap: 8px;
  }
  .brand img {
    width: 29px;
    height: 29px;
  }
  nav {
    gap: 12px;
  }
  nav a:first-child {
    display: none;
  }
  nav .repo {
    font-size: 0.7rem;
    padding: 7px 9px;
  }
  main {
    display: block;
    padding-top: 0;
  }
  .masthead {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    padding: 26px 0 !important;
    margin-bottom: 0;
  }
  .masthead h1 {
    font-size: clamp(2.7rem, 10.5vw, 3.8rem);
  }
  .description {
    font-size: 0.94rem;
  }
  .category {
    font-size: 0.65rem;
    margin-bottom: 13px;
  }
  .scene {
    width: 100%;
    height: 185px !important;
    margin: 0;
    max-width: none;
    transform: none;
  }
  .scene.diagram {
    height: 150px !important;
    border-radius: 12px;
  }
  .scene.diagram img {
    height: 150px;
  }
  .masthead .scene:not(.diagram) {
    border-radius: 10px;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    border: 0;
  }
  .panel {
    padding: 20px !important;
    border-radius: 10px;
  }
  .panel:last-child {
    position: static;
    border-left: 0;
    padding: 20px !important;
    min-height: 170px;
  }
  .panel:first-child .fields,
  .panel:first-child .inputs {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .panel:first-child .wide {
    grid-column: 1/-1;
    grid-row: auto;
  }
  .panel:first-child textarea {
    min-height: 150px;
  }
  .panel:last-child table {
    font-size: 0.75rem;
  }
  .panel:last-child h2 {
    font-size: 1.2rem;
  }
  .guide {
    margin-top: 20px;
    grid-column: auto;
  }
  .tasks li {
    gap: 6px;
  }
  .tasks li button {
    font-size: 0.68rem;
    padding: 7px;
  }
  .result {
    min-width: 0;
  }
  .editor-tools {
    gap: 8px;
  }
  .actions {
    gap: 8px;
  }
  button,
  .button {
    padding: 10px 12px;
  }
  footer {
    font-size: 0.7rem;
  }
}
@media print {
  header,
  .masthead,
  .panel:first-child,
  footer,
  .no-print,
  .guide,
  .editor-tools,
  .result-status,
  .panel:last-child h2 {
    display: none !important;
  }
  body {
    background: white !important;
    color: black !important;
  }
  main,
  .workspace {
    display: block !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .panel:last-child {
    position: static !important;
    border: 0 !important;
    padding: 0 !important;
    background: white !important;
    color: black !important;
  }
  .result {
    box-shadow: none !important;
    background: white !important;
    color: black !important;
    padding: 0 !important;
  }
  .grid,
  .table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
  }
  .paper58 {
    width: 52mm !important;
  }
  .paper80 {
    width: 72mm !important;
  }
  th,
  td {
    background: white !important;
    color: black !important;
  }
}

.shortcut {
  font-size: 0.65rem;
}

.task-progress {
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 12px;
  accent-color: var(--accent);
}

.shortcut {
  font-size: 0.65rem;
}

.task-progress {
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 12px;
  accent-color: var(--accent);
}

/* Review refinements */
.shortcut {
  white-space: nowrap;
  font-size: 0.65rem;
}
