:root {
  color-scheme: light;
  --bg: #f7f4e9;
  --paper: #fffcf3;
  --ink: #283730;
  --muted: #58645b;
  --line: #c6c7b7;
  --rust: #89501a;
  --gold: #efc373;
  --shadow: #d8d7c8;
  --wash: #e8eada;
  --serif: Georgia,'Times New Roman',serif;
  --mono: ui-monospace,'SFMono-Regular',Menlo,Consolas,monospace;
  font: 16px/1.5 'Helvetica Neue',Arial,sans-serif;
  background: var(--bg);
  color: var(--ink);
}
:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #1d2522;
  --paper: #25302a;
  --ink: #f1eedf;
  --muted: #bbc4b7;
  --line: #566158;
  --rust: #ecc17d;
  --shadow: #141c18;
  --wash: #303b31;
}
* {
  box-sizing: border-box;
}
body,h1,h2,h3,p {
  margin: 0;
}
a,button,input {
  color: inherit;
}
button,summary {
  font: inherit;
  cursor: pointer;
}
button {
  background: var(--paper);
  border: 1px solid var(--line);
}
button:disabled {
  cursor: default;
  opacity: .55;
}
a {
  text-underline-offset: 4px;
}
a:hover {
  text-decoration: underline;
}
:focus-visible {
  outline: 3px solid var(--rust);
  outline-offset: 4px;
}
main:focus:not(:focus-visible),h1:focus:not(:focus-visible),h2:focus:not(:focus-visible) {
  outline: none;
}
.sr,.skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus {
  position: fixed;
  inset: 8px auto auto 8px;
  padding: 10px;
  background: var(--paper);
  z-index: 5;
}
nav,main,.colophon,footer {
  width: min(1200px,calc(100% - 80px));
  margin-inline: auto;
}
header {
  border-bottom: 1px solid var(--line);
}
nav,footer,footer div,.brand,.section-head,.card-foot,.sheet-head,.credits,.controls,.switcher {
  display: flex;
  align-items: center;
}
nav {
  gap: 24px;
  min-height: 70px;
}
.brand {
  gap: 10px;
  text-decoration: none;
  font: bold 22px var(--serif);
  letter-spacing: -1px;
}
.edition,.family,.meta,.counter,.live,.fig,.letter,.cell,.plate text,#theme,.by {
  font-family: var(--mono);
}
.edition,.meta,.by,.counter {
  font-size: 12px;
  color: var(--muted);
}
i:not(em i) {
  color: var(--rust);
  margin-inline: 5px;
}
#theme {
  margin-left: auto;
  border-radius: 30px;
  padding: 7px 14px;
  min-height: 36px;
  font-size: 12px;
}
.intro {
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  align-items: center;
  gap: clamp(32px,6vw,95px);
  padding: 62px 0 64px;
}
.family,.live,.fig {
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 650;
  color: var(--rust);
}
.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
}
.kicker:before {
  content: '';
  width: 30px;
  height: 2px;
  background: var(--rust);
}
h1,h2,h3 {
  font-family: var(--serif);
  font-weight: normal;
  line-height: 1.08;
  letter-spacing: -.045em;
}
.intro h1 {
  font-size: clamp(56px,6vw,88px);
  margin: 18px 0;
}
.intro h1 em {
  display: block;
  color: var(--rust);
  font-weight: 400;
}
.lead {
  color: var(--muted);
  max-width: 43ch;
  font-size: 18px;
  line-height: 1.55;
}
.primary,.try {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 650;
  font-size: 14px;
  min-height: 44px;
  white-space: nowrap;
}
.primary {
  margin-top: 24px;
  padding: 0 19px;
  background: var(--ink);
  color: var(--bg);
}
.try {
  flex-shrink: 0;
  background: var(--gold);
  color: #2c342a;
  border: 1px solid #b59861;
  padding: 0 14px;
}
.specimen,.card,.input-panel,.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.specimen {
  border-color: var(--ink);
  box-shadow: 4px 5px 0 var(--shadow);
}
.sheet-head {
  padding: 6px 16px;
  gap: 13px;
  background: #303e36;
  border-radius: 6px 6px 0 0;
  color: #fff9e8;
}
.live {
  color: inherit;
  letter-spacing: .1em;
}
.live:before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--gold);
  border-radius: 50%;
}
.counter {
  color: #e2e3d6;
  margin-left: auto;
}
.switcher {
  gap: 2px;
}
.switcher button {
  color: inherit;
  border: 0;
  background: transparent;
  font-size: 19px;
  width: 40px;
  height: 40px;
}
.switcher button:hover:enabled {
  background: #49564b;
}
.sheet-head :focus-visible {
  outline-color: var(--gold);
  outline-offset: 0;
}
.plate {
  position: relative;
  display: grid;
  place-items: center;
  color: #2e443b;
  --grid: #4254411a;
  background-color: #e5e9d8;
  background-image: linear-gradient(var(--grid) 1px,transparent 1px),linear-gradient(90deg,var(--grid) 1px,transparent 1px);
  background-size: 19px 19px;
  padding: 26px 18px 10px;
}
.plate.insertion-sort,.plate.interval-schedule {
  background-color: #f2e2c3;
}
.plate.bfs,.plate.binary-search {
  background-color: #dce7e2;
}
.plate svg {
  display: block;
  width: 100%;
  height: 140px;
}
.specimen .plate svg {
  height: clamp(145px,14vw,210px);
}
.fig {
  position: absolute;
  top: 12px;
  left: 14px;
  color: #42594c;
  font-size: 10px;
}
.sheet-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 23px;
}
.sheet-caption h2 {
  font-size: 30px;
  margin: 4px 0 6px;
}
.section-head {
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--ink);
  padding: 22px 0 19px;
}
.section-head h2,.colophon h2 {
  font-size: clamp(29px,3vw,40px);
}
.section-head .meta {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  position: relative;
}
.card-link {
  display: flex;
  flex: 1;
  flex-direction: column;
  text-decoration: none;
  border-radius: 7px;
}
.card-link:hover {
  text-decoration: none;
}
.card-link:hover h3 {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.card .plate {
  border-radius: 7px 7px 0 0;
  border-bottom: 1px solid var(--line);
}
.card-info {
  padding: 20px;
}
.card-info h3 {
  font-size: 29px;
  margin: 7px 0 10px;
}
.card-foot,.credits {
  gap: 12px;
  flex-wrap: wrap;
}
.card-foot {
  border-top: 1px solid var(--line);
  padding: 1px 18px;
  justify-content: space-between;
}
.copy,.restart {
  border: 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  min-height: 44px;
  font-size: 13px;
}
.manual-copy {
  width: 100%;
  font: 13px var(--mono);
  padding: 6px;
}
.colophon {
  margin-top: 52px;
  display: grid;
  grid-template-columns: 1fr minmax(180px,31%);
  align-items: center;
  gap: 25px;
  border-block: 1px solid var(--line);
  background: var(--wash);
  padding: 22px 30px;
}
.colophon h2 {
  margin: 8px 0;
}
.colophon p:not(.family) {
  max-width: 57ch;
  color: var(--muted);
}
.join {
  display: inline-block;
  font-weight: 600;
  font-size: 14px;
  margin-top: 13px;
}
.colophon img {
  width: 100%;
  height: auto;
  max-height: 170px;
  object-fit: cover;
  object-position: 50% 34%;
  border-radius: 4px;
}
footer {
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 30px;
  color: var(--muted);
  font-size: 12px;
}
footer div {
  gap: 18px;
  flex-wrap: wrap;
}
.lesson-intro {
  padding: 26px 0;
}
.back {
  display: inline-block;
  font-size: 14px;
  padding: 6px 0 20px;
}
.lesson-title,.state h1 {
  font-size: clamp(42px,5.5vw,72px);
  margin: 9px 0;
}
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.input-panel h2,.input-panel details,.panel {
  padding: 20px 24px;
}
.input-panel h2,.panel h2 {
  font-size: 30px;
}
.input-panel .plate svg {
  height: clamp(170px,18vw,270px);
}
summary {
  font-size: 14px;
}
.input-text,.move,.takeaway {
  margin-top: 12px;
  line-height: 1.55;
}
.panel .question {
  margin: 10px 0 22px;
  font-size: clamp(25px,2.5vw,35px);
}
.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.answer,.controls button,.state button {
  border-radius: 4px;
  padding: 10px 14px;
  min-height: 44px;
}
.answer {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 20px;
}
.letter {
  font-size: 12px;
  color: var(--muted);
}
.answer:hover,.controls button:hover:enabled,#theme:hover {
  background: var(--wash);
}
.feedback {
  color: var(--rust);
  font-weight: 600;
  margin-bottom: 12px;
}
.current {
  padding: 16px 0;
}
.cells {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
}
.cell {
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 14px;
}
.cell.active {
  background: var(--ink);
  color: var(--bg);
  font-weight: bold;
}
.takeaway {
  border-left: 3px solid var(--gold);
  padding-left: 12px;
}
.controls {
  gap: 8px;
}
.state {
  padding: 60px 0;
  min-height: 300px;
}
.state button {
  margin-top: 18px;
}
.loading-line {
  margin: 20px 0;
  height: 4px;
  width: 100px;
  background: linear-gradient(90deg,var(--gold) 40%,var(--line) 40%);
  border-radius: 5px;
}
@media (prefers-reduced-motion:no-preference) {
  .specimen .plate svg {
    animation: appear .24s ease-out;
  }
  @keyframes appear {
    from {
      opacity: .4;
      transform: translateY(3px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}
@media (max-width:900px) {
  .intro {
    gap: 25px;
  }
  .sheet-caption {
    align-items: start;
    flex-direction: column;
    gap: 10px;
  }
  .grid {
    gap: 12px;
  }
  .card-info {
    padding: 15px;
  }
  .card-foot {
    padding-inline: 13px;
  }
}
@media (max-width:720px) {
  nav,main,.colophon,footer {
    width: calc(100% - 36px);
  }
  nav {
    min-height: 57px;
  }
  .edition {
    display: none;
  }
  .intro,.workspace,.grid {
    grid-template-columns: 1fr;
  }
  .intro {
    padding: 26px 0 32px;
    gap: 22px;
  }
  .intro h1 {
    font-size: clamp(39px,9vw,60px);
    margin: 9px 0;
  }
  .lead {
    font-size: 16px;
  }
  .intro .primary {
    display: none;
  }
  .sheet-caption {
    flex-direction: row;
    align-items: center;
    padding: 14px;
    gap: 10px;
  }
  .sheet-caption h2 {
    font-size: 24px;
  }
  .sheet-caption .by {
    font-size: 11px;
  }
  .try {
    font-size: 12px;
    padding: 0 11px;
  }
  .specimen .plate svg {
    height: 155px;
  }
  .sheet-head {
    padding: 3px 12px;
  }
  .grid {
    gap: 16px;
  }
  .card-info {
    padding: 16px 18px;
  }
  .section-head {
    padding: 16px 0;
  }
  .lesson-intro {
    padding: 16px 0;
  }
  .back {
    padding-bottom: 10px;
  }
  .workspace {
    gap: 14px;
  }
  .input-panel h2,.input-panel details,.panel {
    padding: 15px;
  }
  .input-panel .plate svg {
    height: 140px;
  }
  .colophon {
    margin-top: 32px;
    padding: 20px;
    grid-template-columns: 1fr;
  }
  .colophon img {
    display: none;
  }
  footer {
    align-items: start;
    flex-direction: column;
  }
  .colophon h2 {
    margin-top: 6px;
  }
}
.thumbnail {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 220 / 124;
  border-radius: 7px 7px 0 0;
  border-bottom: 1px solid var(--line);
}
.workshop { margin-top: 44px; }
.workshop .card-info { display: flex; flex-direction: column; flex: 1; align-items: start; }
.brief-summary, .notebook p, .trace-result { line-height: 1.5; }
.workshop .meta { margin: 12px 0; }
.workshop details { margin: 0 0 12px; }
.workshop ul { padding-left: 20px; line-height: 1.45; }
.workshop .join { margin-top: auto; }
.notebook { padding: 18px 24px 24px; border-top: 1px solid var(--line); }
.notebook h2 { padding: 0 0 8px; }
.trace-result { margin-top: 10px; color: var(--muted); }
.teaching-note { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.teaching-note p { margin: 10px 0; line-height: 1.5; }
