/* The class: a classroom in line art. A whiteboard, a roll-down chart hung from a rod, and a professor. */
:root {
  --paper: #F3EBDD;
  --paper2: #EADFCB;
  --sepia: #5A4632;
  --sepia2: #7a6450;
  --sepia3: #a08a6c;
  --hot: #F7962B;
  --broke: #C62828;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --chalk: #dfe7f3;
  --k2-id: #B8661A;
  --k2-version: #2E7D8C;
  --k2-sheet: #A3456E;
}

body.in-class .wrap { visibility: hidden; }

.class {
  position: fixed; inset: 0; z-index: 30;
  display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 10px;
  padding: 14px 18px 12px;
  background: radial-gradient(120% 90% at 60% 0%, #12284a 0%, var(--bg) 70%);
  color: var(--ink);
}
.class.fade-out { opacity: 0; transition: opacity 0.35s ease; }

.stage { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 0 20px; min-height: 0; }

/* the professor: chalk-white lines on the dark wall, standing at the left edge */
.prof { position: relative; align-self: end; height: min(300px, 58vh); color: var(--chalk); z-index: 2; pointer-events: none; }
.prof-svg { height: 100%; width: auto; overflow: visible; display: block; }
.prof .face, .prof .jacket { fill: #0f2442; }
.prof .tie { fill: var(--hot); stroke: var(--hot); }
.prof .arm { transform-box: view-box; transform-origin: 104px 112px; }
.prof .head { transform-box: view-box; transform-origin: 80px 96px; }
.bubble {
  position: absolute; left: 62%; top: -6px;
  font: italic 600 15px var(--serif); color: #0b1a31; background: var(--chalk);
  border-radius: 14px; padding: 4px 11px; white-space: nowrap;
  opacity: 0; transform: translateY(4px);
}
.bubble::after { content: ""; position: absolute; left: 10px; bottom: -6px; border: 6px solid transparent; border-top-color: var(--chalk); border-bottom: 0; }
.bubble.on { opacity: 1; transform: none; transition: opacity 0.2s, transform 0.2s; }

/* the whiteboard */
.board {
  position: relative; min-height: 0; min-width: 0;
  background: #f4f6f8; border: 3px solid #8796ad; border-radius: 10px;
  box-shadow: inset 0 0 0 5px #e4e9ef, 0 18px 40px rgba(0, 0, 0, 0.35);
  margin-bottom: 12px;
}
.tray { position: absolute; left: 10%; right: 10%; bottom: -13px; height: 8px; border-radius: 0 0 6px 6px; background: #8796ad; }
.rod {
  position: absolute; left: 10px; right: 10px; top: 8px; height: 8px; z-index: 4;
  border-radius: 4px; background: linear-gradient(#8a6c4c, #5b4330);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.rod::before, .rod::after { content: ""; position: absolute; top: -3px; width: 14px; height: 14px; border-radius: 50%; background: #5b4330; }
.rod::before { left: -6px; } .rod::after { right: -6px; }

/* the specimen (cold open, dismissal), drawn on the whiteboard */
.specimen {
  position: absolute; left: 3%; right: 4%; bottom: 7%;
  display: flex; align-items: flex-end; gap: 90px;
  color: #22324a;
}
.spec-svg { width: clamp(150px, 22vw, 230px); height: auto; overflow: visible; flex: none; }
.spec-svg .page { fill: #fff; stroke: #22324a; stroke-width: 2.4; stroke-linejoin: round; }
.spec-svg .fold { fill: none; stroke: #22324a; stroke-width: 2; }
.spec-twb text { font: 600 10.5px var(--mono); fill: #22324a; }
.spec-twb, .spec-gown, .spec-burst { transform-box: fill-box; transform-origin: 50% 90%; }
.spec-gown .page { fill: #e8eef6; }
.spec-gown .zip { stroke: #22324a; stroke-width: 2; }
.spec-gown .teeth { stroke: #22324a; stroke-width: 1.6; }
.spec-gown .pull { fill: #fff; stroke: #22324a; stroke-width: 2; }
.spec-gown .tag { font: 700 17px var(--sans); fill: #22324a; }
.spec-burst { opacity: 0; transform-origin: 50% 50%; }
.spec-burst path { fill: #fff3c4; stroke: var(--broke); stroke-width: 2; stroke-linejoin: round; }
.spec-burst text { font: 900 22px var(--sans); fill: var(--broke); }
.spec-side { min-width: 0; max-width: 560px; padding-bottom: 24px; }
.bcap { font: italic 500 clamp(20px, 2.4vw, 30px)/1.3 var(--serif); color: #22324a; margin: 0 0 18px; min-height: 2.6em; }
.spec-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.skip { color: #4a5d7a; font-size: 14px; }
.skip:hover { color: #22324a; }

/* buttons on the wall and the board */
.chalk {
  font: inherit; font-size: 14.5px; font-weight: 600; color: var(--ink);
  background: transparent; border: 1.5px solid #4a6a98; border-radius: 9px; padding: 9px 18px; cursor: pointer;
}
.chalk:hover { border-color: var(--chalk); }
.chalk:disabled { opacity: 0.35; cursor: default; }
.chalk.primary { background: var(--hot); border-color: var(--hot); color: #1b1206; }
.chalk.primary:hover { background: #ffaa4d; }
.board .chalk:not(.primary) { color: #22324a; border-color: #8796ad; }

/* the roll-down chart */
.chart { position: absolute; left: 24px; right: 24px; top: 14px; bottom: 34px; z-index: 3; pointer-events: none; --drop: 0px; transform-origin: 50% 0; }
.chart.down { pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; top: 0; bottom: 16px;
  clip-path: inset(0 0 100% 0);
  overflow: auto; overscroll-behavior: contain;
  background: var(--paper);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  border-left: 1px solid #d9ccb5; border-right: 1px solid #d9ccb5;
}
.chart.down .sheet { clip-path: inset(0 0 0 0); }
.roller { position: absolute; left: -8px; right: -8px; top: 0; height: 16px; transform: translateY(var(--drop)); }
.dowel {
  position: absolute; inset: 0; border-radius: 8px;
  background: linear-gradient(#efe5d3 0%, #d8c7aa 55%, #b9a382 100%);
  border: 1px solid #8a7358;
}
.ring {
  position: absolute; left: 50%; top: 13px; width: 26px; height: 26px; margin-left: -13px;
  border-radius: 50%; border: 3px solid #8a7358; background: transparent; cursor: pointer; pointer-events: auto;
}
.ring::before { content: ""; position: absolute; left: 50%; top: -9px; width: 2px; height: 9px; margin-left: -1px; background: #8a7358; }
.ring:hover { border-color: var(--hot); }

/* the plate: an anatomy-textbook page */
.plate { height: 100%; padding: 10px; color: var(--sepia); font-family: var(--serif); display: flex; }
.rule {
  position: relative; flex: 1; min-height: 0; min-width: 0;
  border: 4px double var(--sepia); outline: 1px solid var(--sepia); outline-offset: 3px;
  padding: 14px 18px 12px;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px;
}
.corner { position: absolute; top: 6px; right: 12px; font-size: 12px; font-variant: small-caps; letter-spacing: 0.06em; color: var(--sepia2); }
.phead { padding-right: 190px; }
.ptitle-h { margin: 0; font: 600 clamp(19px, 2vw, 25px)/1.15 var(--serif); letter-spacing: 0.1em; text-transform: uppercase; color: var(--sepia); }
.joke { margin: 3px 0 0; font: italic 15px/1.35 var(--serif); color: var(--sepia2); }
.pbody { display: grid; grid-template-columns: minmax(250px, 400px) minmax(0, 1fr); gap: 22px; min-height: 0; }
.ptext { min-height: 0; overflow: auto; padding-right: 4px; }
.ptext h3 { margin: 12px 0 3px; font: 700 12.5px var(--serif); font-variant: small-caps; letter-spacing: 0.1em; text-transform: lowercase; color: var(--sepia2); }
.ptext h3:first-child { margin-top: 0; }
.ptext p, .ptext li { margin: 0; font-size: 15.5px; line-height: 1.5; color: #3d2f20; }
.ptext ul { margin: 2px 0 0; padding-left: 18px; }
.ptext li { margin: 3px 0; }
.ptext .note { font-size: 13.5px; font-style: italic; color: var(--sepia2); margin-top: 8px; }
.ptext b { color: #2b2014; }
.ptext code { font: 13px var(--mono); background: var(--paper2); padding: 0 3px; border-radius: 2px; }
.breaks { border-left: 3px solid var(--hot); padding-left: 9px; }
.xc {
  margin: 2px 0 0; padding: 8px 10px; font: 12.5px/1.5 var(--mono); color: #3d2f20;
  background: var(--paper2); border: 1px solid #d6c6a8; border-left: 3px solid var(--sepia);
  white-space: pre; overflow-x: auto;
}
.xc mark { background: rgba(247, 150, 43, 0.28); color: #2b2014; border-bottom: 2px solid var(--hot); font-weight: 700; padding: 0 1px; }
.xfile { display: block; font: italic 12.5px var(--serif); color: var(--sepia2); margin-top: 3px; }

/* lesson 1: where the bytes are */
.sbar { display: flex; height: 22px; margin: 8px 0 6px; border: 1.5px solid var(--sepia); background: var(--paper); }
.sbar span { display: block; height: 100%; border-right: 1px solid var(--paper); min-width: 2px; }
.sbar span:last-child { border-right: 0; }
.sbar .s-data { background: var(--sepia); }
.sbar .s-lib { background: #8c7456; }
.sbar .s-app { background: repeating-linear-gradient(135deg, #5A4632 0 2px, #cdb995 2px 5px); }
.sbar .s-rest { background: #dccbae; }
.skey { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; font-size: 13.5px; color: #3d2f20; }
.skey i { width: 11px; height: 11px; display: inline-block; border: 1px solid var(--sepia); margin-top: 4px; }
.skey b { font-family: var(--mono); font-size: 12.5px; text-align: right; white-space: nowrap; }

/* the figure: the engine's diagram, or a drawn plate */
.pfig { position: relative; min-height: 0; display: flex; flex-direction: column; border: 1px solid rgba(90, 70, 50, 0.35); background: #f6f0e4; }
.figbox { position: relative; flex: 1; min-height: 0; }
.figbox > main { position: absolute; inset: 0; }
.custom { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; }
.pinkey { margin: 0; padding: 6px 12px 8px; display: flex; flex-wrap: wrap; gap: 2px 18px; list-style: none; border-top: 1px dashed rgba(90, 70, 50, 0.35); font-size: 13px; }
.pinkey:empty { display: none; }
.pinkey li { display: inline-flex; align-items: center; gap: 6px; }
.pinkey li span.n { width: 19px; height: 19px; border-radius: 50%; border: 1.4px solid var(--sepia); display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; }
.pinkey li code { font: 12.5px var(--mono); color: #3d2f20; }
.pinkey li em { font-style: normal; color: var(--sepia2); font-size: 12px; }

.pfoot { display: flex; justify-content: flex-end; }
.tblock { border-collapse: collapse; font-size: 12px; color: var(--sepia); }
.tblock th, .tblock td { border: 1.5px solid var(--sepia); padding: 3px 9px; text-align: left; }
.tblock th { font: 700 11px var(--serif); font-variant: small-caps; letter-spacing: 0.08em; text-transform: lowercase; background: var(--paper2); }
.tblock td { font: 12px var(--mono); }
.tblock.lit td { background: var(--hot); color: #1b1206; font-weight: 700; }
.tblock.lit th { color: #9a4f05; }

/* lesson 7: three markers */
.dna { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.strand h4 { margin: 0; font: 700 12.5px var(--serif); font-variant: small-caps; letter-spacing: 0.08em; text-transform: lowercase; color: var(--sepia2); }
.strand .hub {
  display: inline-block; margin: 4px 0 6px; padding: 3px 8px; font: 700 12px var(--mono); color: #2b2014;
  border: 2px solid var(--hot); background: rgba(247, 150, 43, 0.16); border-radius: 4px; overflow-wrap: anywhere;
}
.strand ul { list-style: none; margin: 0 0 0 10px; padding: 0 0 0 0; border-left: 2px solid var(--kc); }
.strand li { position: relative; padding: 2px 0 2px 22px; font-size: 13px; line-height: 1.35; color: #3d2f20; }
.strand li::before { content: ""; position: absolute; left: 0; top: 50%; width: 16px; border-top: 2px dashed var(--kc); }
.strand li small { display: block; font: 11px var(--mono); color: var(--sepia2); overflow-wrap: anywhere; }
.strand li.broken { color: var(--broke); font-weight: 700; }
.strand li.broken::before { border-top: 3px solid var(--broke); width: 16px; }
.strand li.broken small { color: var(--broke); }
.mismatch {
  margin: 0 0 12px; padding: 8px 12px; border: 2px solid var(--broke); color: var(--broke);
  font: 700 15px/1.4 var(--serif); background: #fbe9e5;
}
.dnabtns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.pbtn {
  font: 700 14px var(--serif); color: var(--sepia); background: var(--paper); border: 1.5px solid var(--sepia);
  border-radius: 6px; padding: 6px 14px; cursor: pointer;
}
.pbtn:hover { background: var(--paper2); }
.pbtn.danger { color: var(--broke); border-color: var(--broke); }
.pbtn:disabled { opacity: 0.4; cursor: default; }

/* lesson 8: the site settings checklist */
.settings { max-width: 560px; }
.settings .crumb { font: 700 13px var(--serif); font-variant: small-caps; letter-spacing: 0.08em; text-transform: lowercase; color: var(--sepia2); margin-bottom: 8px; }
.settings ul { list-style: none; margin: 0; padding: 0; }
.settings > ul > li { display: grid; grid-template-columns: 26px 1fr; gap: 2px 8px; padding: 10px 0; border-bottom: 1px dashed rgba(90, 70, 50, 0.4); }
.settings b { font-size: 16px; color: #2b2014; }
.settings small { grid-column: 2; font-size: 14px; color: var(--sepia2); }
.cb { width: 20px; height: 20px; border: 2px solid var(--sepia); border-radius: 3px; position: relative; margin-top: 2px; display: inline-block; flex: none; background: #fffaf0; }
.cb.on::after { content: ""; position: absolute; left: 5px; top: 0; width: 6px; height: 12px; border: solid var(--sepia); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.settings .subrow { grid-column: 2; display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 8px 10px; border: 1.5px solid var(--hot); background: rgba(247, 150, 43, 0.1); }
.settings .subrow .t { font-size: 15px; color: #2b2014; }
.settings .subrow em { display: block; font-size: 14px; color: #9a4f05; font-style: italic; }

/* the lesson bar */
.lnav { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; position: relative; }
.dots { display: flex; gap: 7px; }
.dots button { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #6d86ab; background: transparent; padding: 0; cursor: pointer; }
.dots button.done { background: #6d86ab; }
.dots button.on { background: var(--hot); border-color: var(--hot); transform: scale(1.2); }
.lcount { font-size: 13.5px; color: var(--muted); min-width: 92px; text-align: center; }
.lskip { position: absolute; right: 0; color: var(--faint); }
.lskip:hover { color: var(--ink); }
.class.dismissed #nextBtn, .class.cold .lnav .chalk, .class.cold .dots, .class.cold .lcount { visibility: hidden; }

/* tablet: a little tighter */
@media (max-width: 1100px) {
  .pbody { grid-template-columns: minmax(230px, 340px) minmax(0, 1fr); gap: 16px; }
  .dna { grid-template-columns: 1fr 1fr; }
}

/* phone: the professor moves above the board, plates stack and scroll */
@media (max-width: 720px) {
  .class { padding: 8px 10px 8px; gap: 6px; }
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: 62px minmax(0, 1fr); gap: 4px; }
  .prof { height: 62px; align-self: start; justify-self: start; margin-left: 6px; }
  .prof .pointer, .prof .arm circle:last-child { opacity: 0.0; }
  .bubble { left: 46px; top: 4px; font-size: 13px; }
  .board { margin-bottom: 10px; }
  .chart { left: 8px; right: 8px; top: 12px; bottom: 30px; }
  .specimen { flex-direction: column; justify-content: center; align-items: center; text-align: center; top: 8%; bottom: 8%; gap: 10px; }
  .spec-side { padding-bottom: 0; }
  .spec-svg { width: 150px; }
  .spec-actions { justify-content: center; }
  .bcap { min-height: 0; margin-bottom: 12px; }
  .plate { padding: 6px; height: auto; min-height: 100%; }
  .rule { padding: 10px 10px 10px; display: block; }
  .corner { position: static; text-align: right; margin-bottom: 2px; }
  .phead { padding-right: 0; margin-bottom: 10px; }
  .pbody { display: block; }
  .ptext { overflow: visible; padding: 0; }
  .pfig { height: 330px; margin-top: 14px; }
  .pfig.tall { height: auto; }
  .pfig.tall .custom { overflow: visible; }
  .dna { grid-template-columns: 1fr; }
  .pfoot { margin-top: 12px; }
  .tblock { width: 100%; table-layout: fixed; }
  .tblock th, .tblock td { padding: 3px 5px; overflow-wrap: anywhere; font-size: 10.5px; }
  .lnav { gap: 8px; }
  .lnav .chalk { padding: 8px 14px; }
  .lcount { min-width: 0; font-size: 12.5px; }
  .dots { gap: 5px; }
  .dots button { width: 10px; height: 10px; }
  .lskip { position: static; width: 100%; text-align: center; font-size: 12.5px; }
}
@media (max-height: 560px) and (min-width: 721px) {
  .prof { height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble.on, .class.fade-out { transition: none; }
}
