/* ============================================================
   GREASE MONKEY BLUEPRINTS — design system
   Blueprint paper: deep navy sheet, cyan ink, quiet engineering
   ============================================================ */

:root {
  --sheet: #0a1522;          /* page background */
  --sheet-2: #0d1b2c;        /* panels */
  --line: rgba(150, 205, 240, 0.22);   /* hairline ink */
  --line-strong: rgba(150, 205, 240, 0.45);
  --ink: #e8f4fc;            /* primary text */
  --ink-dim: #aecfe2;        /* secondary text */
  --ink-faint: #82a3b8;      /* captions */
  --accent: #61dff2;         /* cyan highlight */
  --accent-dim: rgba(97, 223, 242, 0.14);
  --good: #7fe0a8;
  --warn: #f2c261;
  --bad: #f27f7f;
  --grid: rgba(120, 180, 220, 0.055);
  --grid-strong: rgba(120, 180, 220, 0.11);
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, Menlo, monospace;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--sheet);
  background-image:
    linear-gradient(var(--grid-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  min-height: 100vh;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

::selection { background: var(--accent-dim); }

/* ---------- top navigation: quiet, underlined text ---------- */

.topbar {
  display: flex;
  align-items: baseline;
  gap: 28px;
  padding: 22px 34px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  margin-right: 12px;
  white-space: nowrap;
}
.brand b { color: var(--accent); font-weight: 600; }
.topnav { display: flex; gap: 22px; flex-wrap: wrap; }
.topnav a {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  cursor: pointer;
  padding-bottom: 2px;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
.topnav a:hover { color: var(--ink); text-decoration-color: var(--accent); }
.topnav a.active { color: var(--accent); text-decoration-color: var(--accent); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.progress-pill {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  padding: 5px 14px;
  white-space: nowrap;
}
.progress-pill b { color: var(--accent); font-weight: 600; }

/* ---------- generic layout ---------- */

.page { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 34px; }
.page.wide { max-width: 1440px; }

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
h1, h2, h3 { font-weight: 650; line-height: 1.2; }
h1 { font-size: 36px; letter-spacing: -0.01em; max-width: 22ch; }
h2 { font-size: 23px; margin-bottom: 8px; }
p.lede { color: var(--ink-dim); max-width: 62ch; margin-top: 12px; font-size: 17.5px; }

.section { margin-top: 44px; }
.rule { border: none; border-top: 1px solid var(--line); margin: 26px 0; }

/* ---------- home: the sheet ---------- */

.hero { display: grid; grid-template-columns: 300px 1fr; gap: 40px; align-items: start; }
.hero-side { padding-top: 6px; }
.hero-note {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 2;
  letter-spacing: 0.04em;
  border-left: 1px solid var(--line-strong);
  padding-left: 16px;
  margin-top: 26px;
}
.hero-note em { color: var(--ink-dim); font-style: normal; }

.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: 20px;
}
.variant-card {
  background: var(--sheet);
  padding: 22px 22px 18px;
  cursor: pointer;
  position: relative;
  transition: background 140ms ease;
}
.variant-card:hover { background: var(--sheet-2); }
.variant-card .v-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint);
}
.variant-card h3 { font-size: 18px; margin: 6px 0 4px; }
.variant-card p { font-size: 13px; color: var(--ink-dim); line-height: 1.5; min-height: 3em; }
.variant-card .v-meta {
  margin-top: 12px; display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
}
.variant-card .v-meta .go { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.variant-card .v-progress { height: 2px; background: var(--line); margin-top: 10px; position: relative; }
.variant-card .v-progress i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }

/* ---------- blueprint schematic ---------- */

.schematic-wrap {
  position: relative;
  border: 1px solid var(--line);
  background: var(--sheet-2);
  padding: 10px 14px 4px;
  overflow: hidden;
}
.schematic-wrap svg { display: block; width: 100%; height: auto; }
.schematic-wrap.img-mode { padding: 0; }
.schematic-img { display: block; width: 100%; height: auto; user-select: none; }
.schematic-caption {
  display: flex; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint);
  padding: 10px 2px 0;
}

/* numbered callout balloons on the schematic */
.hs-num {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 27px; height: 27px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--sheet);
  color: var(--ink-dim);
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 3;
  padding: 0;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.hs-num:hover { border-color: var(--accent); color: var(--accent); }
.hs-num.current { background: var(--accent); border-color: var(--accent); color: var(--sheet); box-shadow: 0 0 12px rgba(97,223,242,0.55); }
.hs-num.done { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.hs-num.locked { opacity: 0.4; border-style: dashed; cursor: not-allowed; }

/* legend under the schematic — number key to the callouts */
.legend {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; margin-top: 12px;
  border: 1px solid var(--line); background: var(--line);
}
.legend-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--sheet);
  border: none; cursor: pointer;
  padding: 8px 12px; text-align: left;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--ink-dim);
  transition: background 120ms ease, color 120ms ease;
}
.legend-row:hover { background: var(--sheet-2); color: var(--ink); }
.legend-row .lg-num { flex: none; width: 20px; text-align: center; color: var(--ink-faint); }
.legend-row.current { background: var(--accent-dim); color: var(--accent); }
.legend-row.current .lg-num { color: var(--accent); }
.legend-row.done .lg-num { color: var(--good); }
.legend-row.locked { opacity: 0.45; cursor: not-allowed; }
.legend-row .lg-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- course layout ---------- */

.course-grid { display: grid; grid-template-columns: minmax(400px, 0.9fr) minmax(0, 1.1fr); gap: 40px; align-items: start; }
.lesson-col { min-width: 0; }
.schem-toggle { display: none; margin-bottom: 12px; }

@media (max-width: 1020px) {
  .course-grid { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  /* narrow viewports: lesson text first, schematic after — never on top */
  .lesson-col { order: 1; }
  .schematic-sticky { order: 2; position: static; margin-top: 40px; }
  .schem-toggle { display: inline-block; }
  #schem-panel { display: none; }
  #schem-panel.open { display: block; }
  .legend { grid-template-columns: 1fr; }
}

.schematic-sticky { position: sticky; top: 20px; }

.lesson-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.lesson-head .mod-num {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  color: var(--ink-faint); text-transform: uppercase;
}
.lesson-title { font-size: 30px; }
.lesson-summary { color: var(--ink-dim); margin-top: 10px; font-size: 16.5px; max-width: 60ch; }

/* the chain — linear logic diagram */
.chain { margin: 26px 0 8px; }
.chain-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 14px;
}
.chain-step { display: flex; gap: 14px; position: relative; padding-bottom: 16px; }
.chain-step::before {
  content: ""; position: absolute; left: 13px; top: 28px; bottom: 0;
  width: 1px; background: var(--line-strong);
}
.chain-step:last-child::before { display: none; }
.chain-num {
  flex: none; width: 27px; height: 27px; border: 1px solid var(--line-strong);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  background: var(--sheet);
  position: relative; z-index: 1;
}
.chain-body b { display: block; font-size: 16px; font-weight: 600; }
.chain-body span { font-size: 14.5px; color: var(--ink-dim); }

.lesson-body { margin-top: 24px; max-width: 68ch; }
.lesson-body p { margin-bottom: 15px; color: var(--ink); font-size: 16.5px; line-height: 1.75; }
.lesson-body p b { color: var(--accent); font-weight: 600; }

/* glossary terms inside text */
.term {
  color: var(--ink); border-bottom: 1px dotted var(--accent);
  cursor: help; text-decoration: none;
}
.term:hover { background: var(--accent-dim); }

/* parts strip */
.parts-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--ink-faint); margin: 26px 0 10px;
}
.parts-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.part-chip {
  font-family: var(--mono); font-size: 13px;
  border: 1px solid var(--line-strong);
  background: none; color: var(--ink);
  padding: 8px 14px; cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.part-chip:hover { border-color: var(--accent); background: var(--accent-dim); }
.part-chip .pc-cost { color: var(--ink-faint); margin-left: 8px; font-size: 12px; }

/* ---------- quiz ---------- */
.quiz { margin-top: 34px; border-top: 1px solid var(--line); padding-top: 22px; }
.quiz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.quiz-head h3 { font-size: 16px; }
.quiz-status { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); letter-spacing: 0.1em; }
.quiz-q { margin-top: 20px; }
.quiz-q .q-text { font-size: 16.5px; font-weight: 600; margin-bottom: 12px; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  text-align: left; font-family: var(--sans); font-size: 15.5px;
  background: none; border: 1px solid var(--line);
  color: var(--ink-dim); padding: 12px 16px; cursor: pointer;
  transition: border-color 100ms ease, color 100ms ease, background 100ms ease;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); }
.quiz-opt.correct { border-color: var(--good); color: var(--good); background: rgba(127, 224, 168, 0.07); }
.quiz-opt.wrong { border-color: var(--bad); color: var(--bad); background: rgba(242, 127, 127, 0.06); }
.quiz-opt:disabled { cursor: default; }
.quiz-why {
  margin-top: 12px; font-size: 14.5px; color: var(--ink-dim); line-height: 1.65;
  border-left: 2px solid var(--line-strong); padding-left: 14px;
  display: none;
}
.quiz-why.show { display: block; }
.quiz-why b { color: var(--accent); font-weight: 600; }

.lesson-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 36px; flex-wrap: wrap; }
.textbtn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  background: none; border: none; color: var(--ink-dim);
  text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--line-strong);
  cursor: pointer; padding: 6px 0;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
.textbtn:hover { color: var(--accent); text-decoration-color: var(--accent); }
.textbtn.primary { color: var(--accent); text-decoration-color: var(--accent); }
.textbtn:disabled { color: var(--ink-faint); cursor: not-allowed; text-decoration-color: var(--line); }
.textbtn.locked-label { cursor: not-allowed; }

.lesson-locked-note {
  font-size: 13px; color: var(--ink-faint); font-family: var(--mono);
  margin-top: 30px; border: 1px dashed var(--line-strong); padding: 14px 16px;
}

/* ---------- outline page ---------- */
.outline-list { margin-top: 24px; border-top: 1px solid var(--line); }
.outline-row {
  display: flex; align-items: baseline; gap: 18px;
  padding: 13px 4px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background 120ms ease;
}
.outline-row:hover { background: var(--sheet-2); }
.outline-row .o-num { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); width: 34px; flex: none; }
.outline-row .o-name { font-size: 15px; font-weight: 600; }
.outline-row .o-sum { font-size: 13px; color: var(--ink-dim); margin-left: 6px; }
.outline-row .o-state { margin-left: auto; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); flex: none; }
.outline-row .o-state.done { color: var(--accent); }
.outline-row.locked { opacity: 0.5; cursor: not-allowed; }

/* ---------- glossary page ---------- */
.glossary-search {
  width: 100%; max-width: 420px;
  background: var(--sheet-2); border: 1px solid var(--line-strong);
  color: var(--ink); font-family: var(--mono); font-size: 13px;
  padding: 10px 14px; outline: none; margin: 18px 0 26px;
}
.glossary-search:focus { border-color: var(--accent); }
.glossary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.glossary-item { background: var(--sheet); padding: 16px 18px; border: 1px solid transparent; transition: border-color 150ms ease; }
.glossary-item b { font-family: var(--mono); font-size: 13.5px; color: var(--accent); font-weight: 600; display: block; margin-bottom: 6px; }
.glossary-item span { font-size: 14px; color: var(--ink-dim); line-height: 1.65; display: block; }

/* ---------- modal (part card) ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(4, 10, 17, 0.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 22px;
}
.modal {
  background: var(--sheet-2); border: 1px solid var(--line-strong);
  width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto;
  padding: 28px 30px 24px; position: relative;
}
.modal .m-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.modal h3 { font-size: 21px; margin-bottom: 2px; }
.modal .m-aka { font-size: 12px; color: var(--ink-faint); font-family: var(--mono); margin-bottom: 16px; }
.m-figure {
  border: 1px dashed var(--line-strong); padding: 18px; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: center; min-height: 110px;
}
.m-figure svg { width: 100%; height: auto; max-height: 190px; }
.m-figure.img { border: none; padding: 4px 0 10px; }
.m-figure.img img { width: 100%; max-height: 240px; object-fit: contain; display: block; }
.m-row { display: grid; grid-template-columns: 128px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14.5px; line-height: 1.65; }
.m-row .m-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); padding-top: 3px; }
.m-row .m-val { color: var(--ink); line-height: 1.55; }
.m-row .m-val.cost { font-family: var(--mono); color: var(--warn); font-size: 13px; }
.m-cost-note { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }
.modal .close-x {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: var(--ink-dim);
  font-family: var(--mono); font-size: 13px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px;
}
.modal .close-x:hover { color: var(--accent); }

/* term popover */
.term-pop {
  position: fixed; z-index: 60; max-width: 320px;
  background: var(--sheet-2); border: 1px solid var(--accent);
  padding: 12px 16px; font-size: 13px; color: var(--ink);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.term-pop b { font-family: var(--mono); color: var(--accent); display: block; margin-bottom: 4px; font-size: 12px; letter-spacing: 0.08em; }
.term-pop-img {
  display: block; width: 100%; max-height: 170px; object-fit: cover;
  border: 1px solid var(--line); margin: 6px 0 8px;
}

/* glossary hover part-photo preview */
.g-pic-hint {
  display: inline-block; width: 9px; height: 9px; margin-left: 6px;
  border: 1px solid var(--ink-faint); vertical-align: baseline;
  background: linear-gradient(135deg, transparent 55%, var(--ink-faint) 56%);
}
.glossary-item[data-fig] { cursor: default; }
.glossary-item[data-fig]:hover { border-color: var(--accent); }
#gloss-preview {
  display: none; position: fixed; z-index: 70; width: 220px;
  background: var(--sheet-2); border: 1px solid var(--accent);
  box-shadow: 0 12px 40px rgba(0,0,0,0.6); pointer-events: none;
}
#gloss-preview img { display: block; width: 100%; height: 150px; object-fit: cover; }
#gloss-preview span {
  display: block; padding: 7px 10px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.14em; color: var(--accent);
}

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line);
  padding: 20px 34px; margin-top: 50px;
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* misc */
.center-note { text-align: center; color: var(--ink-faint); font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; padding: 40px 0; }
.badge-done { color: var(--good); font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }

@media (max-width: 640px) {
  .page { padding: 20px 16px; }
  .topbar { padding: 16px 16px 10px; gap: 16px; }
  h1 { font-size: 26px; }
  .m-row { grid-template-columns: 1fr; gap: 3px; }
}

/* ---------- edition gate (free demo → full version) ---------- */

.variant-card.locked { opacity: 0.75; }
.variant-card.locked .go { color: var(--warn); }
.progress-pill.edition-full { color: var(--good); border-color: var(--good); }
.progress-pill.edition-demo { color: var(--warn); border-color: var(--warn); text-decoration: none; }

.modal.upsell { max-width: 560px; }
.upsell-lede { color: var(--ink-dim); font-size: 15px; margin: 12px 0 14px; }
.upsell-list { list-style: none; margin: 0 0 20px; }
.upsell-list li {
  padding: 9px 0 9px 26px;
  position: relative;
  color: var(--ink-dim);
  font-size: 14.5px;
  border-bottom: 1px dashed var(--line);
}
.upsell-list li::before {
  content: '◆';
  position: absolute;
  left: 2px;
  color: var(--accent);
  font-size: 10px;
  top: 13px;
}
.upsell-list li b { color: var(--ink); }
.upsell-buy {
  display: block;
  text-align: center;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 1px;
  padding: 14px 18px;
  color: #04222c;
  background: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
}
.upsell-buy:hover { background: #8ceaf7; }
.upsell-note {
  margin-top: 10px;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-faint);
}

/* ---------- animated blueprint panels ---------- */

.anim-panel {
  margin: 26px 0 8px;
  border: 1px solid var(--line-strong);
  background: var(--sheet-2);
}
.anim-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
  padding: 12px 16px;
  border-bottom: 1px dashed var(--line);
}
.anim-body { padding: 10px 14px 4px; }
.anim-body svg text { user-select: none; }

/* ---------- image highlight-loop animations ---------- */
.imgloop { position: relative; overflow: hidden; border: 1px solid var(--line); }
.imgloop img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; position: absolute; inset: 0; }
.imgloop svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.il-flow {
  fill: none; stroke: #3fc6ff; stroke-width: 9; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 30 20; opacity: 0;
  filter: drop-shadow(0 0 7px rgba(63,198,255,0.9)) drop-shadow(0 0 22px rgba(63,198,255,0.45));
  animation: il-dashflow 1.1s linear infinite;
  transition: opacity 0.45s ease;
}
.il-flow.on { opacity: 0.95; }
.il-flow.lit { opacity: 0.22; }
@keyframes il-dashflow { to { stroke-dashoffset: -50; } }
.il-hl {
  fill: rgba(65,199,255,0.07); stroke: #5fd4ff; stroke-width: 4; opacity: 0;
  filter: drop-shadow(0 0 10px rgba(65,199,255,0.85)) drop-shadow(0 0 30px rgba(65,199,255,0.4));
  transition: opacity 0.4s ease;
}
.il-hl.on { opacity: 1; animation: il-pulse 1.3s ease-in-out infinite; }
@keyframes il-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.il-tag {
  font: 700 30px ui-monospace, Consolas, monospace; letter-spacing: 0.18em;
  fill: #bfeaff; opacity: 0; transition: opacity 0.4s ease;
  paint-order: stroke; stroke: #07101f; stroke-width: 7;
  filter: drop-shadow(0 0 12px rgba(65,199,255,0.6));
}
.il-tag.on { opacity: 1; }
.anim-caption {
  padding: 8px 16px 14px;
  font-size: 13px;
  color: var(--ink-faint);
  font-style: italic;
}

/* chain step synced to the running animation */
.chain-step.live {
  border-color: var(--accent);
  background: var(--accent-dim);
  transition: background 0.25s, border-color 0.25s;
}
.chain-step.live .chain-num {
  color: #04222c;
  background: var(--accent);
}

/* ---------- arcade ---------- */

.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 28px; }
.game-card {
  border: 1px solid var(--line-strong);
  background: var(--sheet-2);
  padding: 24px 22px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.game-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.game-card.locked { opacity: 0.65; cursor: default; }
.game-card.locked:hover { border-color: var(--line-strong); transform: none; }
.game-card h3 { margin-bottom: 8px; }
.game-card p { font-size: 14px; color: var(--ink-dim); margin-bottom: 14px; }

.game-gate {
  margin-top: 22px;
  border: 1px dashed var(--warn);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--ink-dim);
}
.game-gate b { color: var(--ink); }
.game-gate-btn { padding: 10px 16px !important; font-size: 12px !important; width: auto; display: inline-block !important; }

.game-hud { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }

.chain-game-list { margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.chain-game-step {
  display: flex; align-items: center; gap: 14px;
  background: var(--sheet-2); border: 1px solid var(--line);
  padding: 13px 16px; cursor: pointer; text-align: left;
  color: var(--ink); font-family: var(--sans); font-size: 14.5px;
  transition: border-color 0.15s, background 0.15s;
}
.chain-game-step:hover:not(:disabled) { border-color: var(--accent); }
.chain-game-step:disabled { cursor: default; }
.chain-game-step.correct { border-color: var(--good); background: rgba(127,224,168,0.07); }
.chain-game-step.wrong { border-color: var(--bad); background: rgba(242,127,127,0.10); }
.chain-game-step.revealed { border-color: var(--warn); opacity: 0.85; }
.cg-marker {
  min-width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); color: var(--ink-faint);
  font-family: var(--mono); font-size: 13px;
}
.chain-game-step.correct .cg-marker,
.chain-game-step.revealed .cg-marker { background: var(--accent); color: #04222c; border-color: var(--accent); }

.parts-game-card { border: 1px solid var(--line-strong); background: var(--sheet-2); padding: 20px; margin: 20px 0; }
.parts-game-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.parts-opt { font-size: 15px; }

.game-end { text-align: center; padding: 60px 0; }
.game-score {
  font-family: var(--mono);
  font-size: clamp(56px, 10vw, 96px);
  color: var(--accent);
  line-height: 1;
  margin: 18px 0 14px;
}

/* ---------------- symptom decoder ---------------- */
.counter-lines { border: 1px solid var(--line-strong); background: var(--sheet-2); padding: 22px 24px; margin: 26px 0 40px; }
.counter-title { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; color: var(--accent); margin-bottom: 14px; }
.counter-line { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 14px; padding: 10px 0; border-top: 1px dashed var(--line); align-items: baseline; }
.counter-line:first-of-type { border-top: none; }
.counter-line b { font-family: var(--mono); font-size: 14px; color: var(--ink); font-weight: 600; }
.counter-line span { font-size: 13.5px; color: var(--ink-dim); line-height: 1.55; }
@media (max-width: 700px) { .counter-line { grid-template-columns: 1fr; gap: 4px; } }

.sym-cat { font-family: var(--mono); font-size: 13px; letter-spacing: 0.18em; color: var(--accent); margin: 44px 0 14px; padding-top: 22px; border-top: 2px solid var(--line-strong); }
.sym-card { border: 1px solid var(--line-strong); background: var(--sheet); margin-bottom: 14px; }
.sym-head { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.sym-head b { font-size: 16.5px; color: var(--ink); }
.sym-body { padding: 18px 20px; }
.sym-plain { font-size: 15px; line-height: 1.7; color: var(--ink); margin-bottom: 16px; }
.sym-row { display: grid; grid-template-columns: 170px 1fr; gap: 16px; padding: 12px 0; border-top: 1px dashed var(--line); }
.sym-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--ink-faint); padding-top: 3px; }
.sym-row ul { margin: 0; padding-left: 18px; }
.sym-row li { font-size: 14px; color: var(--ink-dim); line-height: 1.6; margin-bottom: 4px; }
.sym-row p { margin: 0; font-size: 14px; color: var(--ink-dim); line-height: 1.6; }
.sym-talk { margin-bottom: 10px; }
.sym-talk b { font-family: var(--mono); font-size: 13.5px; color: var(--accent); display: block; margin-bottom: 2px; font-weight: 600; }
.sym-talk span { font-size: 13.5px; color: var(--ink-dim); line-height: 1.55; display: block; }
.sym-cost { font-family: var(--mono); font-size: 13.5px; color: var(--accent); }
@media (max-width: 700px) { .sym-row { grid-template-columns: 1fr; gap: 6px; } }

/* ---------------- system schematics (zoomable explorer) ---------------- */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 24px; }
.sys-card { display: flex; flex-direction: column; align-items: stretch; text-align: left; background: var(--sheet-2); border: 1px solid var(--line); padding: 0; cursor: pointer; transition: border-color .15s, transform .15s; }
.sys-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.sys-thumb { display: block; height: 130px; overflow: hidden; border-bottom: 1px solid var(--line); }
.sys-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sys-name { font-family: var(--mono); font-size: 13px; letter-spacing: .06em; color: var(--ink); padding: 10px 12px 4px; }
.sys-meta { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-faint); padding: 0 12px 12px; }

.sys-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0 10px; }
.sys-zoom-label { font-family: var(--mono); font-size: 12px; color: var(--accent); min-width: 44px; }
.sys-toolbar-note { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--ink-faint); flex: 1; text-align: center; }

.sys-viewport { border: 1px solid var(--line-strong); background: var(--sheet-2); height: 66vh; min-height: 420px; overflow: hidden; cursor: grab; }
.sys-viewport.dragging { cursor: grabbing; }
.sys-viewport svg { width: 100%; height: 100%; display: block; }
.sys-grid-line { fill: none; stroke: rgba(150,205,240,0.06); stroke-width: 1; }
.sys-flow { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 8 6; opacity: .7; }
.sys-arrow-head { fill: var(--accent); opacity: .9; }
.sys-node { cursor: pointer; }
.sys-node-ring { fill: var(--sheet); stroke: var(--line-strong); stroke-width: 1.5; }
.sys-node-frame { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: .55; }
.sys-node:hover .sys-node-frame { opacity: 1; stroke-width: 2.5; }
.sys-node-num circle { fill: var(--accent); }
.sys-node-num text { font-family: var(--mono); font-size: 12px; font-weight: 700; fill: #06222c; }
.sys-node-label { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; fill: var(--ink-dim); }
.sys-node:hover .sys-node-label { fill: var(--accent); }

#sys-tip { display: none; position: fixed; z-index: 60; width: 240px; background: var(--sheet-2); border: 1px solid var(--accent); padding: 10px; pointer-events: none; }
#sys-tip img { display: block; width: 100%; height: 130px; object-fit: cover; margin-bottom: 8px; }
#sys-tip b { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--accent); display: block; margin-bottom: 4px; }
#sys-tip span { font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; display: block; }
#sys-tip em { display: block; margin-top: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; color: var(--ink-faint); font-style: normal; }
