:root {
  font:
    16px/1.7 Arial,
    sans-serif;
  color: #243941;
  background: #f4f3ef;
  --accent: #b35a31;
  --line: #d8ded7;
  --dark: #15242c;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: inherit;
}
button,
select,
input {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid transparent;
  background: #e5e9df;
  color: #243941;
  border-radius: 5px;
  padding: 10px 14px;
  min-height: 44px;
  font-size: 14px;
  line-height: 1.4;
}
button:hover:not(:disabled) {
  background: #d7ddce;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible,
select:focus-visible {
  outline: none;
  border-color: #b35a31;
}
a:focus-visible,
input:focus-visible {
  outline: 2px solid #b35a31;
  outline-offset: 3px;
}
button[aria-pressed="true"],
button[aria-current="step"] {
  background: #263e43;
  color: white;
}
h1,
h2,
h3,
p {
  margin: 0 0 16px;
}
h1,
h2,
h3 {
  font-weight: 500;
  line-height: 1.25;
}
h1 {
  font-size: 30px;
  letter-spacing: -1px;
}
h1 span {
  color: var(--accent);
}
h2 {
  font-size: 25px;
  letter-spacing: -0.5px;
}
h3 {
  font-size: 18px;
}
header {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #fbfaf7;
  border-bottom: 1px solid var(--line);
  gap: 20px;
}
.brand {
  text-decoration: none;
  font-size: 25px;
  font-weight: bold;
  letter-spacing: -1px;
}
.brand span {
  font-weight: normal;
}
header nav {
  display: flex;
  gap: 18px;
  font-size: 14px;
}
header a[aria-current] {
  color: var(--accent);
}
.logic-workspace {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr) minmax(330px, 400px);
  height: calc(100dvh - 80px);
}
.lesson-nav,
.experiment,
.reading {
  overflow-y: auto;
  min-width: 0;
  scrollbar-gutter: stable;
}
.lesson-nav {
  padding: 24px 18px;
  border-right: 1px solid var(--line);
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 1.4px;
  color: #a6512e;
  font-weight: bold;
  line-height: 1.5;
}
.lesson-nav > p:not(.eyebrow) {
  font-size: 14px;
  color: #53646b;
}
.lesson-nav nav {
  display: grid;
  gap: 5px;
  margin: 22px 0;
}
.lesson-nav nav button {
  text-align: left;
  display: flex;
  gap: 10px;
  background: transparent;
}
.lesson-nav nav button[aria-current="step"] {
  background: #263e43;
}
.lesson-nav nav button span {
  opacity: 0.65;
}
.module-back {
  display: block;
  margin-top: 20px;
  font-size: 14px;
}
.experiment {
  padding: 24px;
}
.lab-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.view-switch {
  display: flex;
  gap: 4px;
}
.logic-stage {
  position: relative;
  height: clamp(310px, 40vw, 460px);
  background: var(--dark);
  border-radius: 10px;
  overflow: hidden;
  color: #e6eded;
  margin: 12px 0;
}
.logic-stage canvas,
.logic-stage svg {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.logic-stage svg text {
  font:
    18px Arial,
    sans-serif;
  fill: #f1f3ed;
}
.logic-stage svg .node-value {
  font-size: 28px;
  font-weight: bold;
}
.logic-stage svg .node-small {
  font-size: 14px;
  fill: #b6c7c8;
}
#board-status {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  font-size: 13px;
  pointer-events: none;
  background: #15242cd9;
  border-radius: 4px;
  padding: 5px 8px;
  text-align: center;
}
.board-actions {
  position: absolute;
  bottom: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
}
.board-actions button {
  background: #29434be8;
  color: white;
  font-size: 13px;
}
.model-scope {
  font-size: 13px;
  color: #50646a;
  line-height: 1.6;
}
.lab-controls,
.data-panel,
.assumptions {
  border: 1px solid var(--line);
  background: #fbfaf7;
  padding: 18px;
  border-radius: 8px;
  margin: 16px 0;
}
.lab-controls label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0 2px;
  font-size: 14px;
}
.lab-controls input[type="range"] {
  width: 100%;
  accent-color: #a65230;
  min-height: 36px;
}
.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lab-controls select {
  padding: 8px;
  border: 1px solid #8a9d9c;
  border-radius: 4px;
  background: #fff;
  color: #243941;
}
.lab-controls p {
  font-size: 14px;
}
.results {
  background: #eaf0e4;
  padding: 15px;
  border-left: 3px solid #728b61;
  margin: 16px 0;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  white-space: pre-line;
}
.quiet {
  background: transparent;
  text-decoration: underline;
}
.table-scroll {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
caption {
  text-align: left;
  font-size: 13px;
  color: #52666b;
  margin: 0 0 8px;
}
th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #dde3db;
}
th {
  font-weight: 600;
}
tr.current {
  background: #e7ecdf;
  color: #203b3e;
}
summary {
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  padding: 8px 0;
}
details p {
  margin: 12px 0;
}
.reading {
  border-left: 1px solid var(--line);
  padding: 24px;
  background: #fbfaf7;
}
.definition {
  background: #e9ede1;
  border-left: 3px solid #9a674a;
  padding: 18px;
  margin: 22px 0;
}
.definition p:last-child {
  margin-bottom: 0;
}
.definition h3 {
  font-weight: 600;
}
.try-this {
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 22px 0;
}
.try-this p:last-of-type {
  font-size: 14px;
  color: #52656b;
}
.knowledge-check {
  margin: 24px 0;
}
.knowledge-check button,
#assessment-options button {
  display: block;
  width: 100%;
  text-align: left;
  margin: 8px 0;
}
.knowledge-check p,
#assessment-feedback {
  margin-top: 16px;
}
.lesson-paging {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.sources {
  margin: 24px 0;
  display: grid;
  gap: 12px;
  font-size: 14px;
}
.mobile-shortcuts {
  display: none;
}
.skip {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 50;
  background: white;
  padding: 12px;
}
.skip:focus {
  top: 10px;
}
dialog {
  border: 1px solid #b9c5bc;
  background: #fbfaf7;
  color: #243941;
  padding: 30px;
  border-radius: 10px;
  width: min(620px, 95vw);
  max-height: 90dvh;
  overflow: auto;
}
dialog::backdrop {
  background: #101d26b8;
}
.close {
  float: right;
  font-size: 24px;
  background: transparent;
}
#assessment-next {
  margin-top: 18px;
}
#assessment-title {
  clear: both;
}
#trace-section p {
  font-size: 14px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1150px) and (min-width: 941px) {
  .logic-workspace {
    grid-template-columns: 200px minmax(0, 1fr) 320px;
  }
  .experiment {
    padding: 18px;
  }
  .lesson-nav {
    padding: 22px 12px;
  }
  .logic-stage {
    height: 340px;
  }
  h1 {
    font-size: 26px;
  }
}
@media (max-width: 940px) {
  header {
    height: auto;
    min-height: 80px;
    padding: 16px;
    flex-wrap: wrap;
    gap: 10px;
  }
  header nav {
    font-size: 13px;
    gap: 14px;
  }
  .logic-workspace {
    display: block;
    height: auto;
    padding-bottom: 85px;
  }
  .lesson-nav,
  .experiment,
  .reading {
    overflow: visible;
    scrollbar-gutter: auto;
  }
  .lesson-nav {
    padding: 22px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .lesson-nav nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .lesson-nav h1 br {
    display: none;
  }
  .lesson-nav nav button {
    padding: 10px;
    font-size: 14px;
  }
  .experiment,
  .reading {
    padding: 24px 16px;
  }
  .reading {
    border: 0;
    border-top: 1px solid var(--line);
  }
  .logic-stage {
    height: 340px;
  }
  .lab-controls,
  .data-panel {
    padding: 14px;
  }
  .mobile-shortcuts {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    gap: 10px;
    padding: 10px;
    background: #fbfaf7f5;
    border-top: 1px solid var(--line);
    z-index: 10;
  }
  .mobile-shortcuts button {
    flex: 1;
    background: #263e43;
    color: white;
  }
  .lab-heading h2 {
    font-size: 24px;
  }
  .model-scope {
    font-size: 13px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  button:focus-visible,
  select:focus-visible {
    border-color: Highlight;
  }
  tr.current {
    outline: 1px solid Highlight;
  }
}

.logic-stage {
  overflow-x: auto;
}
.logic-stage svg {
  min-width: 640px;
  touch-action: pan-x;
}
.logic-stage canvas {
  position: absolute;
  inset: 0;
}
.logic-stage svg text.node-small {
  font-size: 16px;
}

button[aria-pressed="true"]:hover,
button[aria-current="step"]:hover,
.mobile-shortcuts button:hover {
  background: #355057;
  color: #fff;
}
@media(max-width:940px){header nav{flex-wrap:wrap}}
