/* ============================================================
   THINK IN BITS - CS lesson system
   One stylesheet for every CS lesson page. Each lesson is a
   single HTML file that runs in two modes:

     Read    - continuous scroll, full detail, what students use
     Present - one section at a time, projected, what Mr. Krigger uses

   Same content, same file, no second copy to keep in sync.
   Tokens mirror the 9709 decks so a CS lesson and a math deck
   feel like the same site.
   ============================================================ */

:root {
  --ground: #0a0a0a; --ground-far: #1a1a2e;
  --surface: #1a1a1a; --surface-lift: #2a2a2a;
  --accent: #00e5ff;  --accent-deep: #0099cc;
  --accent-wash: rgba(0,229,255,0.10); --accent-line: rgba(0,229,255,0.30);
  --text: #ffffff; --text-2: #b0b0b0; --text-3: #7d7d7d;
  --hairline: rgba(255,255,255,0.07); --hairline-strong: rgba(255,255,255,0.16);
  --ok: #4fe08a; --ok-soft: rgba(79,224,138,0.12); --ok-line: rgba(79,224,138,0.32);
  --warn: #ff6b6b; --warn-soft: rgba(255,107,107,0.12); --warn-line: rgba(255,107,107,0.32);
  --gold: #ffc857; --gold-soft: rgba(255,200,87,0.12); --gold-line: rgba(255,200,87,0.30);
  --shadow-card: 0 10px 30px rgba(0,0,0,0.5);
  --font: 'Poppins', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 20px;
  --measure: 74ch;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  background-image: linear-gradient(157deg, var(--ground) 0%, #12121f 52%, var(--ground-far) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ============================================================
   CHROME
   ============================================================ */

.tib-back {
  position: fixed; top: 14px; left: 16px; z-index: 30;
  display: inline-flex; align-items: center; gap: 0.5em;
  font-size: 13px; font-weight: 500; color: var(--text-2); text-decoration: none;
  background: rgba(26,26,26,0.82); border: 1px solid var(--hairline);
  border-radius: 50px; padding: 7px 15px 7px 12px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: color .15s ease, border-color .15s ease;
}
.tib-back:hover { color: var(--accent); border-color: var(--accent-line); }

.modebar {
  position: fixed; top: 14px; right: 16px; z-index: 30;
  display: flex; gap: 3px; padding: 4px;
  background: rgba(26,26,26,0.82); border: 1px solid var(--hairline);
  border-radius: 50px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.modebar button {
  border: 0; background: transparent; color: var(--text-2);
  font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
  padding: 6px 15px; border-radius: 50px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.modebar button:hover { color: var(--text); }
.modebar button[aria-pressed="true"] {
  background: var(--accent); color: #05222a;
}

.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 12px rgba(0,229,255,0.5);
  transition: width .3s ease; z-index: 40;
}
body:not(.present) .progress { display: none; }

.hud {
  position: fixed; bottom: 16px; right: 18px; z-index: 30;
  font-family: var(--mono); font-size: 12px; color: var(--text-3);
  background: rgba(26,26,26,0.82); border: 1px solid var(--hairline);
  border-radius: 50px; padding: 5px 13px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
body:not(.present) .hud { display: none; }

.keyhint {
  position: fixed; bottom: 16px; left: 18px; z-index: 30;
  font-size: 11.5px; color: var(--text-3);
}
body:not(.present) .keyhint { display: none; }
.keyhint kbd {
  font-family: var(--mono); font-size: 10.5px;
  background: var(--surface-lift); border: 1px solid var(--hairline-strong);
  border-radius: 5px; padding: 1px 5px; color: var(--text-2);
}

/* ============================================================
   READ MODE (default)
   ============================================================ */

.deck { display: block; }

.lesson-head {
  max-width: var(--measure); margin: 0 auto;
  padding: 84px 22px 0;
}
.lesson-head .eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 10px;
}
.lesson-head h1 {
  font-size: clamp(30px, 5vw, 46px); line-height: 1.1; letter-spacing: -0.02em;
  margin: 0 0 12px; text-wrap: balance;
}
.lesson-head .promise {
  font-size: clamp(16px, 2.1vw, 19px); color: var(--accent);
  font-weight: 500; margin: 0 0 18px;
}
.meta {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none;
}
.meta li {
  font-size: 12.5px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 50px; padding: 5px 13px;
}
.meta li b { color: var(--text); font-weight: 600; }
.lesson-head .lede { color: var(--text-2); font-size: 15.5px; margin: 0; }

.slide {
  max-width: var(--measure); margin: 0 auto;
  padding: 30px 22px;
}
.slide + .slide { border-top: 1px solid var(--hairline); }

.slide h2 {
  font-size: clamp(22px, 3vw, 30px); line-height: 1.2; letter-spacing: -0.015em;
  margin: 0 0 14px; text-wrap: balance;
}
.slide h3 {
  font-size: clamp(17px, 2.2vw, 21px); margin: 26px 0 10px; color: var(--text);
}
.slide .daymark {
  display: inline-block; font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
  background: var(--accent-wash); border: 1px solid var(--accent-line);
  border-radius: 50px; padding: 4px 12px; margin: 0 0 12px;
}
.slide p { margin: 0 0 14px; }
.slide p:last-child, .slide ul:last-child, .slide ol:last-child { margin-bottom: 0; }
.slide ul, .slide ol { margin: 0 0 14px; padding-left: 1.4em; }
.slide li { margin-bottom: 7px; }
.slide li::marker { color: var(--accent); }
.slide strong { color: var(--text); font-weight: 600; }
.slide a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.goal {
  color: var(--text-2); font-size: 15px; font-style: normal;
  border-left: 2px solid var(--accent-line); padding-left: 14px; margin: 0 0 18px;
}

/* ---------- tables ---------- */
.twrap { overflow-x: auto; margin: 0 0 16px; -webkit-overflow-scrolling: touch; }
table {
  width: 100%; border-collapse: collapse; font-size: 14px;
  background: var(--surface); border-radius: 12px; overflow: hidden;
}
th, td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--hairline); vertical-align: top; }
th {
  background: var(--surface-lift); font-weight: 600; font-size: 12.5px;
  letter-spacing: .02em; color: var(--text);
}
tbody tr:last-child td { border-bottom: 0; }
td code, th code { white-space: nowrap; }

/* ---------- code ---------- */
pre {
  margin: 0 0 16px; padding: 15px 17px; overflow-x: auto;
  background: #0d0d14; border: 1px solid var(--hairline);
  border-radius: 12px; box-shadow: var(--shadow-card);
}
pre code { font-family: var(--mono); font-size: 13px; line-height: 1.62; color: #dfe6ee; }
:not(pre) > code {
  font-family: var(--mono); font-size: 0.9em;
  background: var(--surface-lift); border: 1px solid var(--hairline);
  border-radius: 6px; padding: 1px 6px; color: var(--accent);
  /* long tokens like an email address or a key must break rather than
     push the page wider than the phone screen */
  overflow-wrap: anywhere; word-break: break-word;
}
.filename {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-3);
  margin: 0 0 5px; letter-spacing: .02em;
}

/* ---------- callouts ---------- */
.callout {
  margin: 0 0 16px; padding: 13px 16px;
  border-radius: 12px; border: 1px solid var(--hairline);
  background: var(--surface); font-size: 14.5px;
}
.callout > :last-child { margin-bottom: 0; }
.callout b:first-child { color: var(--text); }
.callout.check { background: var(--ok-soft); border-color: var(--ok-line); }
.callout.check b:first-child { color: var(--ok); }
.callout.warn { background: var(--warn-soft); border-color: var(--warn-line); }
.callout.warn b:first-child { color: var(--warn); }
.callout.note { background: var(--accent-wash); border-color: var(--accent-line); }
.callout.note b:first-child { color: var(--accent); }
.callout.flag { background: var(--gold-soft); border-color: var(--gold-line); }
.callout.flag b:first-child { color: var(--gold); }

/* ---------- red flag list ---------- */
.flags { list-style: none; padding: 0; margin: 0 0 16px; }
.flags li {
  padding: 11px 14px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-left: 3px solid var(--warn); border-radius: 10px;
  font-size: 14.5px;
}
.flags li b { color: var(--text); }

/* ---------- message samples ---------- */
.msg {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: #0d0d14; border: 1px solid var(--hairline);
  border-radius: 12px; padding: 13px 15px; margin: 0 0 10px;
  color: var(--text-2); white-space: pre-wrap; word-break: break-word;
}
.msg b { color: var(--text); font-weight: 600; }

/* ---------- base and stretch ---------- */
.tiers { display: grid; gap: 12px; margin: 0 0 16px; }
@media (min-width: 720px) { .tiers { grid-template-columns: 1fr 1fr; } }
.tier {
  padding: 15px 17px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--hairline);
}
.tier h4 {
  margin: 0 0 8px; font-size: 12px; font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase;
}
.tier.base { border-top: 3px solid var(--accent); }
.tier.base h4 { color: var(--accent); }
.tier.stretch { border-top: 3px solid var(--gold); }
.tier.stretch h4 { color: var(--gold); }
.tier p, .tier li { font-size: 14px; }
.tier > :last-child { margin-bottom: 0; }

/* ---------- deliverables checklist ---------- */
.turnin { list-style: none; padding: 0; margin: 0 0 16px; }
.turnin li {
  position: relative; padding: 10px 14px 10px 40px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 10px; font-size: 14.5px;
}
.turnin li { display: flex; align-items: flex-start; gap: 11px; padding-left: 14px; min-width: 0; }
/* Exactly two flex children: the tick, and one span holding the whole sentence.
   The span's own contents then flow as normal inline text. */
.turnin li > .w-cl-body { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; }
.turnin li.done { border-color: var(--ok-line); background: var(--ok-soft); }
.turnin li.done > .w-cl-body { opacity: 0.72; }

/* ---------- troubleshooting ---------- */
.trouble { margin: 0 0 16px; }
.trouble details {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: 10px; margin-bottom: 8px; overflow: hidden;
}
.trouble summary {
  cursor: pointer; padding: 11px 15px; font-size: 14.5px; font-weight: 500;
  color: var(--text); list-style: none;
}
.trouble summary::-webkit-details-marker { display: none; }
.trouble summary::before { content: "▸ "; color: var(--accent); }
.trouble details[open] summary::before { content: "▾ "; }
.trouble details[open] summary { border-bottom: 1px solid var(--hairline); }
.trouble .fix { padding: 12px 15px; font-size: 14.5px; color: var(--text-2); }
.trouble .fix > :last-child { margin-bottom: 0; }

.lesson-foot {
  max-width: var(--measure); margin: 0 auto;
  padding: 26px 22px 70px; border-top: 1px solid var(--hairline);
  font-size: 13px; color: var(--text-3);
}
.lesson-foot a { color: var(--text-2); }
body.present .lesson-foot { display: none; }

/* ============================================================
   PRESENT MODE
   One section at a time, sized for a projector.
   ============================================================ */

body.present { overflow: hidden; }
body.present .deck {
  position: fixed; inset: 0;
}
body.present .lesson-head,
body.present .slide {
  position: absolute; inset: 0; max-width: none; margin: 0;
  display: flex; flex-direction: column; justify-content: safe center;
  gap: 1.4vh; padding: 9vh 7vw 12vh; overflow-y: auto;
  visibility: hidden; opacity: 0; transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease, visibility 0s linear .3s;
  border-top: 0;
}
body.present .lesson-head.active,
body.present .slide.active {
  visibility: visible; opacity: 1; transform: none;
  transition: opacity .3s ease, transform .3s ease, visibility 0s;
}

/* scale type up for the room */
body.present .lesson-head h1 { font-size: clamp(34px, 5.6vw, 66px); }
body.present .lesson-head .promise { font-size: clamp(17px, 2.5vw, 28px); }
body.present .lesson-head .lede { font-size: clamp(14px, 1.7vw, 20px); }
body.present .slide h2 { font-size: clamp(24px, 3.5vw, 44px); margin-bottom: 0.6vh; }
body.present .slide h3 { font-size: clamp(17px, 2.1vw, 27px); margin: 1.4vh 0 0.5vh; }
body.present .slide p,
body.present .slide li { font-size: clamp(14px, 1.62vw, 22px); }
body.present .slide p { margin-bottom: 0.9vh; }
body.present .goal { font-size: clamp(14px, 1.7vw, 22px); margin-bottom: 1.2vh; }
body.present table { font-size: clamp(12px, 1.3vw, 18px); }
body.present th, body.present td { padding: 0.75vh 1vw; }
body.present pre { padding: 1.2vh 1.4vw; margin-bottom: 1vh; }
body.present pre code { font-size: clamp(12px, 1.3vw, 18px); }
body.present .callout { font-size: clamp(13px, 1.5vw, 20px); padding: 1.1vh 1.4vw; margin-bottom: 1vh; }
body.present .flags li { font-size: clamp(13px, 1.45vw, 19px); padding: 0.9vh 1.2vw; margin-bottom: 1.6vh; }
body.present .msg { font-size: clamp(11.5px, 1.25vw, 16px); padding: 1vh 1.2vw; }
body.present .tier p, body.present .tier li { font-size: clamp(13px, 1.4vw, 18px); }
body.present .turnin li { font-size: clamp(13px, 1.45vw, 19px); }
body.present .tumbrel, body.present .trouble { font-size: clamp(13px, 1.45vw, 19px); }

/* troubleshooting opens flat when projected, nothing to click */
body.present .trouble details { border: 0; background: transparent; margin-bottom: 0.6vh; }
body.present .trouble details[open] summary { border-bottom: 0; }
body.present .trouble .fix { padding: 0 0 0 18px; }

/* ============================================================
   PHONE
   ============================================================ */

@media (max-width: 560px) {
  :root { --measure: 100%; }
  .lesson-head { padding-top: 76px; }
  .modebar { top: auto; bottom: 14px; right: 50%; transform: translateX(50%); }
  .hud { bottom: 60px; }
  .keyhint { display: none !important; }
  body.present .lesson-head,
  body.present .slide { padding: 8vh 6vw 15vh; }
  th, td { padding: 8px 10px; }

  /* On a phone these pills float over a scrolling page, so make them opaque
     enough that text passing underneath does not read through them. */
  .tib-back, .modebar, .hud { background: rgba(20,20,26,0.95); }

  /* the bottom mode bar would otherwise cover the last line of the footer */
  .lesson-foot { padding-bottom: 96px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* print the lesson as a handout */
@media print {
  body { background: #fff; color: #000; }
  .tib-back, .modebar, .progress, .hud, .keyhint { display: none !important; }
  .slide, .lesson-head { position: static !important; visibility: visible !important; opacity: 1 !important; page-break-inside: avoid; }
  table, pre, .callout { border: 1px solid #999; }
  pre code, code { color: #000; }
}

/* ============================================================
   INTERACTIVE WIDGETS
   Activities students actually do. Every one works in both modes.
   ============================================================ */

[data-widget] {
  margin: 0 0 18px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--hairline-strong);
  border-radius: 16px; box-shadow: var(--shadow-card);
}

.w-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.w-tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #05222a; background: var(--accent); border-radius: 50px; padding: 3px 10px;
}
.w-sub { font-size: 13px; color: var(--text-2); }
.w-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.w-foot { font-size: 12px; color: var(--text-3); margin: 10px 0 0; }

.w-input {
  width: 100%; padding: 11px 14px; font-family: var(--mono); font-size: 15px;
  color: var(--text); background: #0d0d14;
  border: 1px solid var(--hairline-strong); border-radius: 10px;
}
.w-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.w-input::placeholder { color: var(--text-3); }

/* strength meter */
.w-meter {
  height: 8px; margin: 12px 0 9px; border-radius: 50px;
  background: #0d0d14; border: 1px solid var(--hairline); overflow: hidden;
}
.w-fill { display: block; height: 100%; width: 0; border-radius: 50px; transition: width .25s ease, background .25s ease; }
.w-fill.lv1 { background: var(--warn); }
.w-fill.lv2 { background: #ff9f43; }
.w-fill.lv3 { background: var(--gold); }
.w-fill.lv4 { background: var(--ok); }
.w-fill.lv5 { background: linear-gradient(90deg, var(--ok), var(--accent)); }

.w-readout { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.w-verdict { font-size: 17px; font-weight: 700; }
.w-verdict.lv1 { color: var(--warn); }
.w-verdict.lv2 { color: #ff9f43; }
.w-verdict.lv3 { color: var(--gold); }
.w-verdict.lv4, .w-verdict.lv5 { color: var(--ok); }
.w-detail { font-size: 13.5px; color: var(--text-2); font-family: var(--mono); }

/* passphrase */
.w-phrase {
  font-family: var(--mono); font-size: clamp(15px, 2.4vw, 22px); font-weight: 500;
  color: var(--accent); background: #0d0d14; border: 1px solid var(--accent-line);
  border-radius: 10px; padding: 13px 15px; text-align: center;
  word-break: break-all; margin-bottom: 12px;
}

/* buttons */
.w-row { display: flex; gap: 9px; flex-wrap: wrap; }
.w-btn {
  border: 1px solid var(--accent); background: var(--accent); color: #05222a;
  font-size: 13.5px; font-weight: 600; padding: 9px 17px;
  border-radius: 50px; cursor: pointer; transition: opacity .15s ease, background .15s ease;
}
.w-btn:hover { opacity: .86; }
.w-btn.ghost { background: transparent; color: var(--accent); }
.w-btn.ghost:hover { background: var(--accent-wash); }
.w-btn.warn { background: transparent; border-color: var(--warn); color: var(--warn); }
.w-btn.warn:hover { background: var(--warn-soft); }

/* inbox */
.w-score { font-size: 14px; color: var(--text-2); margin-bottom: 11px; }
.w-score b { color: var(--text); }
.w-score b.ok { color: var(--ok); }
.w-mail { display: flex; flex-direction: column; gap: 7px; }
.w-msg { background: #0d0d14; border: 1px solid var(--hairline); border-radius: 11px; overflow: hidden; }
.w-msg.correct { border-color: var(--ok-line); }
.w-msg.wrong { border-color: var(--warn-line); }
.w-msg-head {
  width: 100%; display: flex; align-items: center; gap: 11px; text-align: left;
  background: transparent; border: 0; cursor: pointer; padding: 11px 14px; color: var(--text);
}
.w-msg-head:hover { background: rgba(255,255,255,0.03); }
.w-from { font-weight: 600; font-size: 13.5px; flex: 0 0 auto; max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-subj { font-size: 13.5px; color: var(--text-2); flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-chip, .w-verdict-chip {
  flex: 0 0 auto; font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 50px;
  border: 1px solid var(--hairline-strong); color: var(--text-3);
}
.w-verdict-chip.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.w-verdict-chip.no { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.w-msg-body { padding: 0 14px 13px; border-top: 1px solid var(--hairline); }
.w-msg-meta { font-family: var(--mono); font-size: 12px; color: var(--text-3); padding: 11px 0 9px; word-break: break-all; }
.w-msg-text { font-size: 14px; color: var(--text-2); margin-bottom: 12px; line-height: 1.6; }
.w-feedback { font-size: 13.5px; padding: 11px 13px; border-radius: 9px; }
.w-feedback.ok { background: var(--ok-soft); border: 1px solid var(--ok-line); }
.w-feedback.no { background: var(--warn-soft); border: 1px solid var(--warn-line); }
.w-feedback b { color: var(--text); }
.w-done {
  margin-top: 13px; padding: 13px 15px; border-radius: 11px;
  background: var(--accent-wash); border: 1px solid var(--accent-line); font-size: 14.5px;
}
.w-done b { color: var(--accent); }

/* push simulator */
.w-check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-2); margin-bottom: 13px; cursor: pointer; }
.w-check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.w-term {
  margin: 13px 0 0; padding: 13px 15px; border-radius: 10px;
  background: #07070c; border: 1px solid var(--hairline);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.62; color: var(--text-2);
  white-space: pre-wrap; overflow-x: auto;
}
.w-term.ok { border-color: var(--ok-line); }
.w-term.leak { border-color: var(--warn-line); color: #ffc4c4; }

/* click-to-answer */
[data-widget="choice"] .w-opts { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; }
[data-opt] {
  text-align: left; width: 100%; padding: 11px 14px; font-size: 14.5px;
  background: #0d0d14; color: var(--text);
  border: 1px solid var(--hairline-strong); border-radius: 10px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
[data-opt]:hover { border-color: var(--accent-line); }
.answered [data-opt] { cursor: default; }
.answered [data-opt].right { border-color: var(--ok-line); background: var(--ok-soft); }
.answered [data-opt].not { opacity: .5; }
.answered [data-opt].chose-wrong { border-color: var(--warn-line); background: var(--warn-soft); opacity: 1; }
.w-why { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--accent-wash); border: 1px solid var(--accent-line); font-size: 14px; }

/* track switch (two printers, two ways) */
[data-widget="track"] { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
[data-widget="track"] .w-tlabel { font-size: 13px; color: var(--text-2); margin-right: 4px; }
[data-track] {
  padding: 9px 14px; font-size: 14.5px; font-family: inherit; color: var(--text-2);
  background: #0d0d14; border: 1px solid var(--hairline-strong); border-radius: 50px; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
[data-track]:hover { border-color: var(--accent-line); color: var(--text); }
[data-track].on { border-color: var(--accent); background: var(--accent-wash); color: var(--text); font-weight: 600; }
[data-track] small { font-weight: 500; font-size: 12px; color: var(--text-3); margin-left: 4px; }
[data-track].on small { color: var(--accent); }
[data-show][hidden] { display: none !important; }

/* checklists */
.w-tick { width: 17px; height: 17px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--accent); cursor: pointer; }
.w-tally { font-size: 12.5px; color: var(--text-3); margin: 0 0 16px; }
.w-tally.all { color: var(--ok); }

/* external link marker */
a .ext { font-size: 0.78em; margin-left: 3px; opacity: .75; text-decoration: none; display: inline-block; }

/* ---------- widgets, scaled for the projector ---------- */
body.present [data-widget] { padding: 1.3vh 1.4vw; margin-bottom: 1vh; }
body.present .w-sub, body.present .w-label { font-size: clamp(12px, 1.35vw, 17px); }
body.present .w-input { font-size: clamp(14px, 1.6vw, 21px); padding: 1vh 1.2vw; }
body.present .w-verdict { font-size: clamp(16px, 2vw, 27px); }
body.present .w-detail { font-size: clamp(12px, 1.4vw, 18px); }
body.present .w-phrase { font-size: clamp(15px, 2.1vw, 28px); padding: 1.1vh 1.2vw; }
body.present .w-btn { font-size: clamp(12.5px, 1.4vw, 18px); padding: 0.85vh 1.4vw; }
body.present .w-from, body.present .w-subj { font-size: clamp(12px, 1.35vw, 18px); }
body.present .w-msg-head { padding: 0.85vh 1.1vw; }
body.present .w-msg-text, body.present .w-feedback { font-size: clamp(12px, 1.35vw, 18px); }
body.present .w-term { font-size: clamp(11px, 1.2vw, 16px); }
body.present [data-opt] { font-size: clamp(12.5px, 1.4vw, 19px); padding: 0.9vh 1.2vw; }
body.present .w-foot { font-size: clamp(10.5px, 1.1vw, 14px); }
body.present .w-tally { font-size: clamp(11px, 1.15vw, 15px); }

@media (max-width: 560px) {
  .w-msg-head { flex-wrap: wrap; gap: 4px 9px; }
  .w-from { max-width: none; flex: 1 1 100%; }
  .w-subj { flex: 1 1 100%; white-space: normal; }
  .w-row { flex-direction: column; }
  .w-btn { width: 100%; }
}

/* The inbox is a working surface with eight messages. When projected, let the
   list scroll inside the panel instead of pushing the panel past the screen. */
body.present .w-mail { max-height: 44vh; overflow-y: auto; padding-right: 4px; }
body.present [data-widget="inbox"] { padding-bottom: 1vh; }

/* query checker */
.w-ops { list-style: none; padding: 0; margin: 13px 0 0; display: flex; flex-direction: column; gap: 7px; }
.w-ops li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text-3); }
.w-ops li.on { color: var(--text-2); }
.w-ops li.warnrow { color: var(--warn); }
.w-ops li b { color: inherit; }
.w-ops li.on b { color: var(--ok); }
.w-op-dot {
  flex: 0 0 auto; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%;
  border: 1.5px solid var(--hairline-strong); background: transparent;
}
.w-ops li.on .w-op-dot { background: var(--ok); border-color: var(--ok); }
.w-ops li.warnrow .w-op-dot { background: var(--warn); border-color: var(--warn); }
.w-goal { margin-top: 13px; padding: 11px 14px; border-radius: 10px; font-size: 14px; }
.w-goal.ok { background: var(--ok-soft); border: 1px solid var(--ok-line); }
.w-goal.no { background: var(--gold-soft); border: 1px solid var(--gold-line); }
.w-goal b { color: var(--text); }
body.present .w-ops li { font-size: clamp(12px, 1.35vw, 18px); }
body.present .w-goal { font-size: clamp(12.5px, 1.4vw, 18px); }

/* bits widget */
.w-bitgrid { display: flex; flex-wrap: wrap; gap: 7px; margin: 13px 0 10px; }
.w-byte {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #0d0d14; border: 1px solid var(--hairline); border-radius: 9px;
  padding: 8px 10px; min-width: 78px;
}
.w-char { font-size: 19px; font-weight: 600; color: var(--accent); line-height: 1.1; }
.w-bin { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); letter-spacing: .04em; }
.w-dec { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }
.w-bitcount { font-size: 14px; color: var(--text-2); margin: 0; }
.w-bitcount b { color: var(--text); }

/* cpu stepper */
.w-cpu { display: grid; gap: 12px; margin: 13px 0; }
@media (min-width: 720px) { .w-cpu { grid-template-columns: 1.35fr 1fr; } }
.w-code {
  list-style: none; counter-reset: ln; margin: 0; padding: 12px 0;
  background: #07070c; border: 1px solid var(--hairline); border-radius: 11px;
}
.w-code li {
  counter-increment: ln; display: flex; gap: 12px; padding: 3px 14px; margin: 0;
  border-left: 3px solid transparent;
}
.w-code li::before {
  content: counter(ln); font-family: var(--mono); font-size: 11.5px;
  color: var(--text-3); min-width: 14px; text-align: right; padding-top: 2px;
}
.w-code li code {
  font-family: var(--mono); font-size: 13px; color: var(--text-2);
  background: transparent; border: 0; padding: 0; white-space: pre;
}
.w-code li.now { background: var(--accent-wash); border-left-color: var(--accent); }
.w-code li.now code { color: var(--accent); }
.w-side { display: flex; flex-direction: column; gap: 10px; }
.w-mem, .w-out {
  background: #0d0d14; border: 1px solid var(--hairline); border-radius: 11px; padding: 11px 13px;
}
.w-mem b, .w-out b {
  display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 7px;
}
.w-mem table { background: transparent; font-size: 13px; }
.w-mem td { padding: 3px 0; border: 0; }
.w-mem td:last-child { text-align: right; font-family: var(--mono); color: var(--accent); }
.w-mem .w-foot { margin: 0; }
.w-out pre {
  margin: 0; padding: 0; background: transparent; border: 0; box-shadow: none;
  font-family: var(--mono); font-size: 13px; color: var(--ok); min-height: 2.4em; white-space: pre-wrap;
}
body.present .w-code li code { font-size: clamp(12px, 1.35vw, 18px); }
body.present .w-char { font-size: clamp(16px, 1.9vw, 24px); }
body.present .w-bin { font-size: clamp(10px, 1.1vw, 14px); }
body.present .w-mem table, body.present .w-out pre { font-size: clamp(12px, 1.35vw, 18px); }
body.present .w-bitcount { font-size: clamp(12.5px, 1.4vw, 18px); }


/* ============================================================
   CODE BOXES: label bar, copy button, keycaps
   Added 2026-10-06 after testing with real students.
   ============================================================ */

kbd {
  display: inline-block; font-family: var(--mono); font-size: 0.82em; font-weight: 500;
  line-height: 1.25; color: var(--text);
  background: #232331; border: 1px solid var(--hairline-strong); border-bottom-width: 3px;
  border-radius: 7px; padding: 1px 8px; margin: 0 1px; white-space: nowrap;
}

.codebox { margin: 0 0 16px; border-radius: 12px; box-shadow: var(--shadow-card); }
.codebar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 5px 7px 5px 14px; min-height: 40px;
  background: #171724; border: 1px solid var(--hairline); border-bottom: 0;
  border-radius: 12px 12px 0 0;
}
.codelabel {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); min-width: 0; overflow-wrap: anywhere;
}
.codebox > pre, body.present .codebox > pre {
  margin: 0; border-radius: 0 0 12px 12px; box-shadow: none;
}
.codebox.is-output .codebar { background: #12121a; }
.codebox.is-output .codelabel { color: var(--gold); }
.codebox.is-output > pre { background: #0b0b11; border-style: dashed; }

.copybtn {
  display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto;
  min-height: 32px; padding: 5px 13px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-wash); border: 1px solid var(--accent-line);
  border-radius: 50px; transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.copybtn:hover { background: var(--accent); color: #05222a; }
.copybtn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.copybtn.done { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok); }
.copybtn.failed { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }

body.present .codebar { min-height: 3.6vh; padding-top: .4vh; padding-bottom: .4vh; }
body.present .codelabel { font-size: clamp(10px, 0.95vw, 13px); }
body.present .copybtn { font-size: clamp(11px, 1vw, 14px); min-height: 0; padding: .5vh 1vw; }

@media print { .copybtn { display: none !important; } .codebar { background: #eee; } }

/* ============================================================
   START-OF-DAY CARD
   ============================================================ */

.startcard {
  margin: 0 0 16px; padding: 16px 18px 6px;
  background: linear-gradient(180deg, var(--accent-wash), rgba(0,229,255,0.03));
  border: 1px solid var(--accent-line); border-radius: 16px;
}
.startcard .startbadge {
  display: inline-block; margin: 0 0 10px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #05222a; background: var(--accent); border-radius: 50px; padding: 3px 11px;
}
ol.startsteps { list-style: none; counter-reset: s; margin: 0; padding: 0; }
ol.startsteps > li {
  counter-increment: s; position: relative; min-width: 0;
  padding: 0 0 14px 42px; margin: 0; font-size: 14.5px;
}
ol.startsteps > li::before {
  content: counter(s); position: absolute; left: 0; top: -1px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #05222a; background: var(--accent);
}
ol.startsteps > li > b:first-child { color: var(--text); }
ol.startsteps .codebox, ol.startsteps pre { margin-top: 8px; margin-bottom: 4px; }
ol.startsteps .callout { margin-top: 8px; margin-bottom: 4px; font-size: 13.5px; }
body.present ol.startsteps > li { font-size: clamp(13px, 1.45vw, 19px); padding-bottom: 1.2vh; padding-left: 3.2vw; }
body.present ol.startsteps > li::before { width: 2.1vw; height: 2.1vw; min-width: 24px; min-height: 24px; font-size: clamp(11px, 1.1vw, 15px); }

/* ============================================================
   NANO SCREEN MOCK: what students actually see
   ============================================================ */

.nanomock {
  margin: 0 0 16px; border-radius: 12px; overflow: hidden;
  background: #0b0b11; border: 1px solid var(--hairline-strong);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55; color: #dfe6ee;
}
.nanomock .nm-top { background: #dfe6ee; color: #0b0b11; padding: 2px 12px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.nanomock .nm-body { padding: 10px 12px; min-height: 5.4em; white-space: pre-wrap; overflow-wrap: anywhere; }
.nanomock .nm-cursor { background: #dfe6ee; color: #0b0b11; }
.nanomock .nm-msg { text-align: center; color: var(--text-3); padding-bottom: 6px; }
.nanomock .nm-keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 2px 14px; padding: 6px 12px 9px; border-top: 1px solid var(--hairline); }
.nanomock .nm-keys span { white-space: nowrap; }
.nanomock .nm-keys b { background: #dfe6ee; color: #0b0b11; padding: 0 4px; margin-right: 6px; font-weight: 700; }
.nanomock .nm-keys .hot b { background: var(--gold); }
.nanomock .nm-keys .hot { color: var(--gold); }
.nanomock .nm-prompt { padding: 6px 12px; border-top: 1px solid var(--hairline); color: var(--gold); }
.nanomock .nm-prompt .typed { color: #fff; }

/* ============================================================
   BROWSER MOCK: what a good screenshot looks like
   ============================================================ */

.shots { display: grid; gap: 12px; margin: 0 0 16px; }
@media (min-width: 720px) { .shots { grid-template-columns: 1fr 1fr; } }
.shot { margin: 0; min-width: 0; }
.shot figcaption { font-size: 13px; margin-top: 7px; color: var(--text-2); }
.shot figcaption b { color: var(--text); }
.shot.good figcaption b:first-child { color: var(--ok); }
.shot.bad  figcaption b:first-child { color: var(--warn); }
.bmock { border-radius: 10px; overflow: hidden; border: 2px solid var(--hairline-strong); background: #12121a; }
.shot.good .bmock { border-color: var(--ok-line); }
.shot.bad .bmock { border-color: var(--warn-line); }
.bmock .bm-bar { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: #232331; }
.bmock .bm-dots { display: flex; gap: 4px; flex: 0 0 auto; }
.bmock .bm-dots i { width: 8px; height: 8px; border-radius: 50%; background: #55556a; display: block; }
.bmock .bm-url {
  flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 11.5px; color: var(--text);
  background: #0d0d14; border-radius: 50px; padding: 3px 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bmock .bm-page { padding: 14px 12px; font-family: var(--mono); font-size: 12.5px; color: #dfe6ee; min-height: 56px; overflow-wrap: anywhere; }
.bmock .bm-page.json { color: var(--ok); }
.bmock .bm-cut { padding: 14px 12px; text-align: center; font-size: 12px; color: var(--text-3); font-family: var(--mono); }

/* ============================================================
   PAGE MAP and highlight spans inside code
   ============================================================ */

pre .hl { color: var(--gold); font-weight: 600; }
pre .dim { color: var(--text-3); }
pre .ok { color: var(--ok); }

.findtable td:first-child { white-space: normal; }

/* ============================================================
   SPOT THE DETAILS (photo activity)
   ============================================================ */

.w-spot svg { width: 100%; height: auto; display: block; border-radius: 12px; background: #0d0d14; border: 1px solid var(--hairline); }
.w-spot [data-find] { cursor: pointer; }
.w-spot .ring { pointer-events: all; }
.w-spot [data-find] .ring { fill: none; stroke: transparent; stroke-width: 3; }
.w-spot [data-find]:hover .ring, .w-spot [data-find]:focus .ring { stroke: rgba(0,229,255,0.7); }
.w-spot [data-find].found .ring { stroke: var(--ok); stroke-width: 3.5; }
.w-spot [data-find].decoy.found .ring { stroke: var(--text-3); stroke-dasharray: 5 4; }
.w-spot [data-find]:focus { outline: none; }
.w-spot .w-found { list-style: none; padding: 0; margin: 12px 0 0; }
.w-spot .w-found li { padding: 9px 12px; margin-bottom: 7px; font-size: 13.5px; background: var(--ok-soft); border: 1px solid var(--ok-line); border-radius: 10px; }
.w-spot .w-found li.decoy { background: var(--surface-lift); border-color: var(--hairline-strong); }
.w-spot .w-found li b { color: var(--ok); }
.w-spot .w-found li.decoy b { color: var(--text-2); }
.w-spot .w-tally { margin: 10px 0 0; font-size: 13px; color: var(--text-2); }
.w-spot .w-tally.all { color: var(--ok); font-weight: 600; }

/* ---------- password manager mock ---------- */
.vault { margin: 0 0 16px; border: 1px solid var(--hairline-strong); border-radius: 12px; overflow: hidden; background: #12121a; }
.vault .v-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 8px 13px; background: #232331; font-size: 12px; color: var(--text-2); }
.vault .v-head b { color: var(--accent); }
.vault .v-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 13px; border-top: 1px solid var(--hairline); font-size: 13px; min-width: 0; }
.vault .v-site { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.vault .v-pw { font-family: var(--mono); font-size: 12px; color: var(--text-3); letter-spacing: .05em; min-width: 0; overflow-wrap: anywhere; }
.vault .v-row.fake { background: var(--warn-soft); }
.vault .v-row.fake .v-pw { color: var(--warn); letter-spacing: 0; }

/* spot widget in Present mode: keep the photo and the results on one screen */
body.present .w-spot svg { max-height: 44vh; width: auto; max-width: 100%; margin: 0 auto; }
body.present .w-spot .w-found { max-height: 20vh; overflow-y: auto; }
body.present .w-spot .w-found li { padding: .6vh 1vw; font-size: clamp(11px, 1.15vw, 15px); }

/* ============================================================
   DAY TABS (Read mode). Opt-in with data-tab on a panel.
   Added 2026-10-06: students scrolled past whole days to find theirs.
   ============================================================ */

.tabbar {
  position: sticky; top: 12px; z-index: 25;
  display: flex; gap: 3px; overflow-x: auto; scrollbar-width: none;
  width: fit-content; max-width: min(var(--measure), calc(100% - 32px));
  margin: 72px auto 0; padding: 4px;
  background: rgba(20,20,26,0.95); border: 1px solid var(--hairline-strong);
  border-radius: 50px; box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button {
  flex: 0 0 auto; border: 0; background: transparent; color: var(--text-2);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  padding: 8px 16px; border-radius: 50px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tabbar button:hover { color: var(--text); background: var(--surface-lift); }
.tabbar button.on { background: var(--accent); color: #05222a; }
@media (max-width: 1100px) { .tabbar { top: 58px; } }
@media (max-width: 560px) { .tabbar { top: 56px; margin-top: 62px; } .tabbar button { padding: 8px 13px; font-size: 13px; } }

.deck.tabbed .lesson-head { padding-top: 28px; }
body:not(.present) .tab-off { display: none !important; }
body:not(.present) .deck.tabbed .slide.tab-first { border-top: 0; }

.tabnext {
  max-width: var(--measure); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  padding: 26px 22px 12px; border-top: 1px solid var(--hairline);
}
.tabnext button {
  font-size: 14.5px; font-weight: 600; cursor: pointer;
  padding: 11px 20px; border-radius: 50px;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--hairline-strong);
}
.tabnext button:hover { color: var(--text); border-color: var(--accent-line); }
.tabnext .next { margin-left: auto; color: #05222a; background: var(--accent); border-color: var(--accent); }
.tabnext .next:hover { color: #05222a; filter: brightness(1.08); }

body.present .tabbar, body.present .tabnext { display: none; }
@media print {
  .tabbar, .tabnext { display: none !important; }
  .tab-off { display: block !important; }
}
