:root {
  --orange: #E97211;
  --orange-soft: #FCE9D8;
  --ink: #1B1B1B;
  --grey: #5B5B5B;
  --grey-light: #8A8A8A;
  --grey-soft: #F3F2EE;
  --line: #DCDCDC;
  --green: #2E7D32;
  --red: #C62828;
  --blue: #1565C0;
  --blue-soft: #E8F1FA;
  --yellow: #FFF7E8;
  --yellow-border: #F0C674;
  --code-bg: #1E1E1E;
  --code-fg: #E8E8E8;
  --code-comment: #7B7B7B;
  --code-key: #FFB86C;
  --code-str: #A6E22E;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* Visible keyboard focus everywhere (WCAG 2.4.7). Per-component rules may
   override with a tighter style; this is the safety net so no interactive
   element is ever focused invisibly. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  margin: 0;
  line-height: 1.6;
  background: #FAFAF8;
}

/* ============== HEADER ============== */
header.top {
  background: var(--ink);
  color: #fff;
  /* top padding clears the fixed Ask/Practice/Glossary buttons (top:14 + ~32px) */
  padding: 56px 40px 16px;
}
header.top h1 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.01em;
  font-weight: 600;
}
header.top .sub {
  color: #BABABA;
  font-size: 13px;
}
header.top .meta {
  color: #888;
  font-size: 12px;
  margin-top: 6px;
}

/* ============== QUESTION BAR ============== */
.question-bar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 12px 40px;
}
.question-bar .row {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
}
.question-bar input {
  flex: 1;
  font-size: 15px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
}
.question-bar input:focus {
  outline: none;
  border-color: var(--orange);
}
.question-bar button {
  background: var(--orange);
  color: #fff;
  border: 0;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
}
.question-bar button:hover { background: #C45F08; }
.question-bar .hint {
  max-width: 1200px;
  margin: 8px auto 0;
  font-size: 12px;
  color: var(--grey-light);
}
.question-bar .hint span {
  background: var(--grey-soft);
  padding: 2px 8px;
  border-radius: 3px;
  margin-right: 6px;
  cursor: pointer;
}
.question-bar .hint span:hover { background: var(--orange-soft); }
#suggestions {
  max-width: 1200px;
  margin: 14px auto 0;
}
#suggestions:empty { margin: 0; }
#suggestions .hit {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  background: var(--orange-soft);
  border: 1px solid var(--orange);
  border-radius: 4px;
  padding: 10px 14px;
  margin-bottom: 6px;
  font-size: 14px;
  cursor: pointer;
}
#suggestions .hit:hover { background: #F8D9BC; }
#suggestions .hit:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
#suggestions .hit code {
  background: rgba(255,255,255,0.7);
  padding: 1px 6px;
  border-radius: 3px;
  color: #1B1B1B;
}
#suggestions .hit .why {
  color: var(--grey);
  font-size: 12px;
  margin-top: 4px;
}
#suggestions .empty {
  color: var(--grey-light);
  font-size: 13px;
  font-style: italic;
}
#suggestions .sg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--grey);
  margin: 4px 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
#suggestions .sg-close {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--grey);
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 3px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
#suggestions .sg-close:hover { background: var(--grey-soft); color: var(--ink); border-color: var(--orange); }

/* ============== WORKED EXAMPLE ============== */
/* The example section is <section class="card example"> at parse time but
   convertToAccordion() turns it into <details class="stage-bar example">,
   so these must key off the surviving `.example` class, not `section`. */
.example .quick-stages {
  background: var(--grey-soft);
  padding: 12px 16px;
  border-radius: 4px;
  margin: 10px 0 16px;
  font-size: 13.5px;
  line-height: 1.65;
}
.example .copy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
}
.example .copy-row .label {
  font-size: 13px;
  color: var(--grey);
  flex: 1;
}
.example .copy-btn {
  background: var(--orange);
  color: #fff;
  border: 0;
  padding: 12px 18px;
  min-height: 44px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.example .copy-btn:hover { background: #C45F08; }
.example .copy-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.example .copy-btn.done { background: var(--green); }
.example pre.full {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 18px 20px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.55;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  margin: 6px 0 4px;
}
.example pre.full .c { color: var(--code-comment); font-style: italic; }
.example pre.full .h { color: #8AD7FF; font-style: italic; }
.example pre.full .k { color: var(--code-key); }
.example pre.full .s { color: var(--code-str); }
.example .footer-note {
  font-size: 12.5px;
  color: var(--grey);
  margin-top: 8px;
  font-style: italic;
}

/* ============== NAV TOC ============== */
nav.toc {
  position: sticky;
  top: 0;
  background: rgba(250,250,248,0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  font-size: 13px;
  z-index: 9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
nav.toc .links a {
  color: var(--grey);
  text-decoration: none;
  margin-right: 12px;
}
nav.toc .links a:hover { color: var(--orange); }
nav.toc .glossary-btn {
  background: #fff;
  border: 1px solid var(--line);
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}
nav.toc .glossary-btn:hover { border-color: var(--orange); color: var(--orange); }

/* ============== CONTAINER ============== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ============== INTRO ============== */
section.intro {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: 4px;
  padding: 24px 28px;
  margin: 24px 0;
}
section.intro h2 { margin: 0 0 8px; font-size: 17px; }
section.intro p { margin: 10px 0; font-size: 14.5px; }

/* ============== PIPELINE ============== */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 22px 0 18px;
}
.stage {
  flex: 1 1 130px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s;
}
.stage:hover { background: var(--orange-soft); }
.stage .num {
  font-size: 11px;
  color: var(--grey);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.stage .name { font-weight: 600; font-size: 14.5px; margin-top: 2px; }
.stage .desc { font-size: 12px; color: var(--grey); margin-top: 4px; line-height: 1.4; }

/* ============== SECTIONS ============== */
section.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 18px 0;
  padding: 22px 26px 18px;
  scroll-margin-top: 60px;
}
section.card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
section.card h2 .num {
  background: var(--orange);
  color: #fff;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 600;
}
section.card .context {
  font-style: italic;
  color: var(--blue);
  background: var(--blue-soft);
  padding: 12px 16px;
  border-left: 3px solid var(--blue);
  margin: 14px 0 18px;
  font-size: 14px;
  line-height: 1.55;
}
section.card h3 {
  font-size: 14px;
  margin: 22px 0 10px;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
section.card p { font-size: 14.5px; }

/* ============== COMMAND CARD (collapsible) ============== */
.cmd {
  border: 1px solid var(--line);
  border-radius: 4px;
  margin: 8px 0;
  background: #FDFCFA;
  overflow: hidden;
}
.cmd[open] { background: #fff; border-color: var(--orange); }
.cmd > summary {
  cursor: pointer;
  padding: 10px 14px;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.cmd > summary::-webkit-details-marker { display: none; }
.cmd > summary::before {
  content: "▶";
  color: var(--orange);
  font-size: 10px;
  transition: transform 0.15s;
}
.cmd[open] > summary::before { transform: rotate(90deg); }
.cmd > summary code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  background: var(--grey-soft);
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 13px;
  color: #1B1B1B;
}
.cmd[open] > summary code { background: var(--orange-soft); }
.cmd > summary .short {
  color: var(--grey);
  font-size: 13.5px;
  flex: 1;
}
.cmd .body { padding: 4px 18px 16px 32px; font-size: 14px; }
.cmd .body h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--grey-light);
  margin: 14px 0 6px;
  font-weight: 600;
}
.cmd .body .what    { color: var(--ink); }
.cmd .body .tokens  {
  background: var(--grey-soft);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  margin: 4px 0;
}
.cmd .body .tokens .row {
  display: grid;
  grid-template-columns: minmax(120px, 200px) 1fr;
  gap: 12px;
  padding: 3px 0;
  border-bottom: 1px dashed #D8D6D0;
}
.cmd .body .tokens .row:last-child { border-bottom: 0; }
.cmd .body .tokens .row code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  color: #C7254E;
  font-size: 12.5px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  align-self: start;
}
.cmd .body .cond {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 4px 0 6px;
}
.cmd .body .cond > div {
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  border-left: 3px solid;
}
.cmd .body .cond .req      { background: #F3F8F3; border-color: var(--green); }
.cmd .body .cond .imp      { background: #FFF7E8; border-color: var(--yellow-border); }
.cmd .body .cond .avoid    { background: #FBEAEA; border-color: var(--red); }
.cmd .body .cond .label    {
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 4px;
}
.cmd .body .cond .req .label   { color: var(--green); }
.cmd .body .cond .imp .label   { color: #8A5A00; }
.cmd .body .cond .avoid .label { color: var(--red); }
.cmd .body .reach {
  background: var(--blue-soft);
  border-left: 3px solid var(--blue);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13.5px;
  margin: 4px 0;
}
.cmd .body pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 10px 14px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12.5px;
  margin: 6px 0;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.45;
}
.cmd .body pre .c { color: var(--code-comment); font-style: italic; }
.cmd .body pre .k { color: var(--code-key); }
.cmd .body pre .s { color: var(--code-str); }
/* Auto-linked terms appear in command cards and also in decision boxes,
   the worked example, and the intro prose — style them everywhere. */
.glossary-link {
  color: var(--blue);
  text-decoration: underline dotted;
  cursor: pointer;
}
.glossary-link:hover { text-decoration-style: solid; }
.glossary-link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============== ORIENTATION BLOCK ============== */
.orient {
  background: #FAFAF8;
  border: 1px dashed var(--grey-light);
  border-radius: 4px;
  padding: 12px 16px;
  margin: 4px 0 14px;
  font-size: 13.5px;
  color: var(--grey);
}
.orient strong { color: var(--ink); }

/* ============== DECISION BOX ============== */
.decision {
  background: #FFF7E8;
  border: 1px solid var(--yellow-border);
  border-radius: 6px;
  padding: 14px 18px;
  margin: 14px 0;
}
.decision h4 { margin: 0 0 8px; color: #8A5A00; font-size: 15px; }
.decision .options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.decision .opt {
  background: #fff;
  border-left: 3px solid;
  padding: 10px 12px;
  font-size: 13px;
}
.opt.kill   { border-color: var(--red); }
.opt.fill   { border-color: var(--green); }
.opt.ignore { border-color: var(--blue); }
.opt .label {
  font-weight: 600;
  font-size: 13px;
  display: block;
  margin-bottom: 4px;
}
.opt.kill .label   { color: var(--red); }
.opt.fill .label   { color: var(--green); }
.opt.ignore .label { color: var(--blue); }
.opt code {
  background: var(--grey-soft);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: #C7254E;
}

/* ============== GLOSSARY DRAWER ============== */
aside.drawer {
  position: fixed;
  top: 0; right: -480px;
  width: 460px; max-width: 90vw;
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(0,0,0,0.06);
  transition: right 0.22s;
  z-index: 50;
  overflow-y: auto;
  padding: 22px 22px 60px;
}
aside.drawer.open { right: 0; }
aside.drawer h2 { margin: 0 0 4px; font-size: 18px; }
aside.drawer .close-x {
  position: absolute;
  top: 10px; right: 12px;
  background: none; border: 0;
  cursor: pointer; font-size: 20px; color: var(--grey);
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
aside.drawer .close-x:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
aside.drawer input {
  width: 100%;
  font-size: 14px;
  padding: 8px 12px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
}
aside.drawer input:focus { outline: none; border-color: var(--orange); }
aside.drawer .entry {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
aside.drawer .entry .term {
  font-weight: 600;
  font-size: 14px;
  color: var(--orange);
}
aside.drawer .entry .term .syn {
  font-weight: 400;
  color: var(--grey-light);
  font-size: 12px;
  margin-left: 6px;
}
aside.drawer .entry .def {
  font-size: 13.5px;
  margin-top: 4px;
  color: var(--ink);
}
aside.drawer .empty {
  color: var(--grey-light);
  font-style: italic;
  font-size: 13px;
}
.scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.2);
  z-index: 40; opacity: 0; pointer-events: none;
  transition: opacity 0.22s;
}
.scrim.open { opacity: 1; pointer-events: auto; }

footer {
  text-align: center;
  color: var(--grey-light);
  font-size: 12px;
  margin-top: 60px;
}

/* ============== HERO + ENTRY CARDS ============== */
section.hero {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 24px 28px 20px;
  margin: 22px 0 18px;
}
section.hero h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
section.hero .lede {
  font-size: 15px;
  color: var(--grey);
  margin: 0 0 18px;
  line-height: 1.5;
}
section.hero .entry-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 6px 0 16px;
}
section.hero .entry-card {
  background: #FAFAF8;
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  padding: 14px 16px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
section.hero .entry-card:hover {
  background: var(--orange-soft);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233, 114, 17, 0.12);
}
section.hero .ec-step {
  font-size: 11px;
  color: var(--grey);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
section.hero .ec-head {
  font-weight: 600;
  font-size: 15px;
  margin-top: 4px;
}
section.hero .ec-body {
  font-size: 13px;
  color: var(--grey);
  margin-top: 6px;
  line-height: 1.5;
}
section.hero details.about {
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
section.hero details.about > summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--grey);
  font-weight: 600;
  list-style: none;
}
section.hero details.about > summary::-webkit-details-marker { display: none; }
section.hero details.about > summary::before {
  content: "▶";
  color: var(--orange);
  font-size: 10px;
  margin-right: 8px;
  transition: transform 0.15s;
  display: inline-block;
}
section.hero details.about[open] > summary::before {
  transform: rotate(90deg);
}
section.hero details.about p {
  font-size: 14px;
  margin: 12px 0;
  line-height: 1.6;
}

/* ============== SECTION MARKER ============== */
.section-marker {
  font-size: 11px;
  color: var(--grey-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 24px 0 6px 4px;
  font-weight: 600;
}

/* ============== FLOATING GLOSSARY ============== */
.floating-glossary-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 30;
  background: var(--orange);
  color: white;
  border: 0;
  padding: 9px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  font-family: inherit;
}
.floating-glossary-btn:hover { background: #C45F08; }

/* ============== BACK TO TOP ============== */
.back-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 25;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--grey);
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  font-family: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.back-top.visible { opacity: 1; pointer-events: auto; }
.back-top:hover { color: var(--orange); border-color: var(--orange); }

/* ============== ASK FAB + OVERLAY ============== */
.ask-fab {
  position: fixed;
  top: 14px;
  right: 254px;
  z-index: 30;
  background: #fff;
  color: var(--orange);
  border: 2px solid var(--orange);
  padding: 7px 16px 7px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ask-fab:hover { background: var(--orange); color: #fff; }
.ask-fab .ask-icon {
  background: var(--orange);
  color: #fff;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  transition: background 0.15s, color 0.15s;
}
.ask-fab:hover .ask-icon { background: #fff; color: var(--orange); }

/* Practice FAB — same shape as Ask, sits between Ask and Glossary. */
.task-fab {
  position: fixed;
  top: 14px;
  right: 134px;
  z-index: 30;
  background: #fff;
  color: var(--orange);
  border: 2px solid var(--orange);
  padding: 7px 16px 7px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.task-fab:hover { background: var(--orange); color: #fff; }
.task-fab .ask-icon {
  background: var(--orange);
  color: #fff;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  transition: background 0.15s, color 0.15s;
}
.task-fab:hover .ask-icon { background: #fff; color: var(--orange); }

/* ---- Practice panel ---- */
.task-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.task-filter-label {
  font-size: 12px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
#task-stage-filter {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
  background: #fff;
}
#task-next {
  background: var(--orange);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
#task-next:hover { background: #C45F08; }
.task-reset {
  background: none;
  border: 1px solid var(--line);
  color: var(--grey);
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  margin-left: auto;
}
.task-reset:hover { border-color: var(--orange); color: var(--orange); }

.task-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.task-type {
  background: var(--orange-soft);
  color: var(--orange);
  padding: 3px 9px;
  border-radius: 3px;
  font-weight: 700;
}
.task-stage { color: var(--grey-light); align-self: center; }
.task-question {
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.task-code, .task-solution {
  background: var(--ink);
  color: #f4f4f4;
  padding: 12px 14px;
  border-radius: 5px;
  font-size: 13.5px;
  overflow-x: auto;
  margin: 0 0 14px;
  white-space: pre;
}

/* ---- sample-data block (copyable mini-DataFrame) ---- */
.task-dataset {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0 0 16px;
  overflow: hidden;
}
.task-dataset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--grey-soft);
  padding: 7px 12px;
}
.task-dataset-head .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--grey);
  font-weight: 700;
}
.task-copy {
  background: #fff;
  border: 1px solid var(--orange);
  color: var(--orange);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.task-copy:hover { background: var(--orange); color: #fff; }
.task-copy.done { background: #E3F3E3; border-color: #5BA85B; color: #2f7d2f; }
.task-dataset-label {
  font-size: 12.5px;
  color: var(--grey);
  font-style: italic;
  padding: 8px 12px 0;
}
.task-setup {
  background: var(--ink);
  color: #f4f4f4;
  padding: 12px 14px;
  margin: 8px 0 0;
  font-size: 13px;
  overflow-x: auto;
  white-space: pre;
  border-radius: 0;
}

.task-options { display: flex; flex-direction: column; gap: 8px; }
.task-opt {
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 11px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.task-opt:hover:not(:disabled) { background: var(--grey-soft); border-color: var(--grey); }
.task-opt:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; }
.task-opt:disabled { cursor: default; }
.task-opt.correct {
  background: #E3F3E3;
  border-color: #5BA85B;
  font-weight: 600;
}
.task-opt.wrong {
  background: #F7DEDE;
  border-color: #C66;
}
.task-code-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.task-reveal {
  background: #fff;
  border: 1px solid var(--orange);
  color: var(--orange);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.task-reveal:hover:not(:disabled) { background: var(--orange); color: #fff; }
.task-reveal:disabled { opacity: 0.5; cursor: default; }
.task-hint, .task-why {
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--grey-soft);
  border-left: 3px solid var(--orange);
  padding: 10px 14px;
  border-radius: 0 4px 4px 0;
  margin-bottom: 12px;
}
.task-hint .label, .task-why .label, .task-related .label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--grey);
  font-weight: 700;
  margin-bottom: 3px;
}
.task-related { margin-top: 8px; }
.task-rel {
  background: var(--grey-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 8px;
  margin: 4px 6px 0 0;
  cursor: pointer;
  font-family: inherit;
}
.task-rel:hover { background: var(--orange-soft); border-color: var(--orange); }
.task-rel code { font-size: 12px; }
.task-empty { color: var(--grey); font-size: 14px; }

.ask-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 60;
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding-top: 80px;
}
.ask-overlay.open { display: flex; }
.ask-panel {
  background: #fff;
  border-radius: 8px;
  max-width: 700px;
  width: 92%;
  max-height: 80vh;
  padding: 22px 26px 26px;
  position: relative;
  box-shadow: 0 12px 50px rgba(0,0,0,0.3);
  overflow-y: auto;
}
.ask-panel .ask-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: 0;
  font-size: 24px;
  cursor: pointer;
  color: var(--grey);
  line-height: 1;
  padding: 4px 8px;
}
.ask-panel .ask-close:hover { color: var(--ink); }
.ask-panel h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.ask-panel .ask-sub { margin: 0 0 16px; color: var(--grey); font-size: 13px; }
.ask-panel .ask-row { display: flex; gap: 8px; }
.ask-panel input {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: inherit;
}
.ask-panel input:focus { outline: none; border-color: var(--orange); }
.ask-panel button#ask {
  background: var(--orange);
  color: #fff;
  border: 0;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ask-panel button#ask:hover { background: #C45F08; }
.ask-panel .hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--grey-light);
}
.ask-panel .hint span {
  background: var(--grey-soft);
  padding: 3px 8px;
  border-radius: 3px;
  margin-right: 6px;
  cursor: pointer;
  display: inline-block;
  margin-top: 4px;
}
.ask-panel .hint span:hover { background: var(--orange-soft); }
.ask-panel #suggestions { margin-top: 14px; }

/* ============== STAGE BARS (accordion) ============== */
details.stage-bar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin: 6px 0;
  overflow: hidden;
  scroll-margin-top: 16px;
}
details.stage-bar[open] {
  border-color: var(--orange);
  box-shadow: 0 2px 14px rgba(233, 114, 17, 0.08);
}
details.stage-bar > summary {
  cursor: pointer;
  padding: 14px 22px;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 14px;
  background: #FDFCFA;
  transition: background 0.1s;
}
details.stage-bar > summary:hover { background: var(--orange-soft); }
details.stage-bar[open] > summary {
  background: #FFF8F0;
  border-bottom: 1px solid var(--line);
}
details.stage-bar > summary::-webkit-details-marker { display: none; }
details.stage-bar > summary::before {
  content: "▶";
  color: var(--orange);
  font-size: 11px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
details.stage-bar[open] > summary::before { transform: rotate(90deg); }
details.stage-bar .bar-num {
  font-size: 11px;
  color: var(--grey);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  flex-shrink: 0;
  min-width: 70px;
  font-weight: 700;
}
details.stage-bar .bar-title {
  font-weight: 600;
  font-size: 15.5px;
  color: var(--ink);
  flex-shrink: 0;
}
details.stage-bar .bar-desc {
  font-size: 13px;
  color: var(--grey);
  flex: 1;
  font-weight: 400;
}
details.stage-bar .bar-body {
  padding: 18px 22px 18px;
}
details.stage-bar .bar-body > h3:first-child { margin-top: 6px; }

@media (max-width: 720px) {
  header.top { padding-top: 96px; }
  .ask-fab { right: auto; left: 14px; top: 14px; }
  .task-fab { right: auto; left: 14px; top: 52px; }
  .floating-glossary-btn { top: 14px; right: 14px; }
  section.hero { padding: 18px 20px; }
  details.stage-bar > summary { flex-wrap: wrap; gap: 6px 12px; }
  details.stage-bar .bar-desc { flex-basis: 100%; margin-top: 2px; }
  .ask-overlay { padding-top: 60px; }
}
