:root {
  --cream: #F6F4EB;
  --navy: #23334E;
  --blue: #3467D4;
  --green: #E7EDD8;
  --surface: #FFFEFA;
  --line: #DCD8C8;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--cream);
  color: var(--navy);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

a {
  color: var(--blue);
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

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

/* ---------- Buttons ---------- */

.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 14px 22px;
  font-weight: 700;
  font-size: 15px;
  min-height: 48px;
}

.btn-primary {
  background: var(--blue);
  color: var(--surface);
  box-shadow: 0 4px 0 #1f449e;
}

.btn-ghost {
  background: var(--surface);
  color: var(--navy);
  border: 1px solid var(--line);
  box-shadow: 0 3px 0 var(--line);
}

@media (prefers-reduced-motion: no-preference) {
  .btn-primary, .btn-ghost, .map-node, .practice-option {
    transition: transform 0.12s ease;
  }
  .btn-primary:active, .btn-ghost:active {
    transform: translateY(3px);
  }
}

.btn-back {
  border: none;
  background: none;
  color: var(--navy);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 4px;
  min-height: 44px;
}

/* ---------- Start screen ---------- */

.start-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 24px;
}

.start-tag {
  font-family: 'Space Grotesk', serif;
  font-style: italic;
  font-size: 28px;
  color: var(--blue);
  margin: 0;
}

.start-title {
  font-size: 56px;
  letter-spacing: -1px;
}

.start-subtitle {
  color: var(--navy);
  opacity: 0.75;
  font-size: 16px;
  margin: 0 0 20px;
}

.btn-huge {
  font-size: 20px;
  padding: 18px 48px;
  border-radius: 18px;
}

/* ---------- Form (Tingkatan) screen ---------- */

.form-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.form-title {
  font-size: 30px;
  text-align: center;
  margin: 40px 0 32px;
}

.form-choices {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 640px) {
  .form-choices {
    flex-direction: row;
  }
}

.form-choice {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 20px;
  box-shadow: 0 4px 0 var(--line);
  text-align: center;
}

.form-choice-big {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
}

/* ---------- Map (chapter path) screen ---------- */

.map-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.map-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.map-title {
  font-size: 22px;
}

.map-nav-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-arrow {
  border: none;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 3px 0 var(--line);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
  flex-shrink: 0;
}

.map-track-wrap {
  flex: 1;
  overflow: hidden;
}

.map-track {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 40px 24px;
  scrollbar-width: thin;
}

.map-node {
  scroll-snap-align: center;
  flex: 0 0 auto;
  width: 160px;
  min-height: 130px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 0 var(--line);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.map-node-offset {
  transform: translateY(26px);
}

.map-node-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--blue);
}

.map-node-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.map-node-status {
  margin-top: auto;
  font-size: 11px;
  color: var(--navy);
  opacity: 0.6;
  background: var(--green);
  border-radius: 20px;
  padding: 3px 9px;
  display: inline-block;
  width: fit-content;
}

/* ---------- Coming soon screen ---------- */

.soon-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.soon-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 40px 20px;
}

.soon-eyebrow {
  color: var(--blue);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.soon-title {
  font-size: 28px;
}

.soon-message {
  font-size: 16px;
  opacity: 0.8;
}

/* ---------- Lesson screen ---------- */

.lesson-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
}

.lesson-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.lesson-chapter-title {
  font-size: 12px;
  color: var(--blue);
  font-weight: 700;
  margin: 0;
}

.lesson-note-title {
  font-size: 18px;
  font-weight: 700;
  margin: 2px 0 0;
}

.lesson-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow: auto;
}

@media (min-width: 900px) {
  .lesson-body {
    flex-direction: row;
    overflow: hidden;
  }
}

.lesson-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  overflow: auto;
}

.lesson-diagram {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}

.lesson-explain {
  flex: 1;
}

.lesson-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.lesson-progress {
  font-size: 13px;
  color: var(--navy);
  opacity: 0.7;
}

/* Equation / diagram pieces */

.eq-big {
  font-family: 'Space Grotesk', serif;
  font-size: 30px;
  line-height: 1.5;
}

.eq-static {
  color: var(--navy);
}

.eq-part {
  color: var(--blue);
  font-weight: 700;
  border-radius: 8px;
  padding: 2px 6px;
}

.eq-part.is-active,
.set-chip.is-active {
  background: var(--green);
}

.eq-op {
  opacity: 0.6;
  margin: 0 2px;
}

.fx-whole {
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
}

.diagram-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.toggle-btn {
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
}

.toggle-btn.is-active {
  background: var(--blue);
  color: var(--surface);
  border-color: var(--blue);
}

.diagram-variant {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.diagram-variant[hidden] {
  display: none;
}

.variant-caption {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.variant-note {
  font-size: 12px;
  opacity: 0.7;
  margin: 0;
}

.mapping-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mapping-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
}

.chip-in {
  background: var(--green);
  color: var(--navy);
}

.chip-out {
  background: var(--blue);
  color: var(--surface);
}

.mapping-arrow {
  color: var(--navy);
  opacity: 0.5;
}

.chip-sets {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.set-chip {
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: 14px;
  padding: 10px 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.set-chip-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.set-chip-items {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
}

.compute-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.75;
}

.compute-input {
  width: 120px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 18px;
  text-align: center;
  background: var(--cream);
  color: var(--navy);
}

.compute-result {
  min-height: 24px;
}

.compute-step {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  margin: 4px 0;
}

.compute-final {
  color: var(--blue);
  font-weight: 700;
}

.compute-error {
  color: #a8431e;
  font-size: 14px;
}

.inverse-steps {
  text-align: left;
}

/* Explain panel */

.explain-tabs {
  display: flex;
  gap: 4px;
  background: var(--cream);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  width: fit-content;
}

.explain-tab {
  border: none;
  background: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.explain-tab.is-active {
  background: var(--surface);
  color: var(--blue);
}

.explain-body {
  font-size: 15px;
  line-height: 1.6;
}

.explain-body p {
  margin: 0 0 12px;
}

.basic-help-link {
  border: none;
  background: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 0;
  text-align: left;
}

.misconceptions {
  margin-top: 16px;
  background: var(--green);
  border-radius: 12px;
  padding: 14px 16px;
}

.misconceptions-label {
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 6px;
}

.misconceptions ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.help-label {
  font-weight: 700;
  margin-bottom: 8px;
}

.mxc-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.mxc-chip {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12px;
}

.mxc-chip-sym {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  color: var(--blue);
  font-weight: 700;
}

/* ---------- Practice screen ---------- */

.practice-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.practice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.practice-progress {
  font-size: 13px;
  opacity: 0.7;
}

.practice-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.practice-prompt {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 18px;
}

.practice-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.practice-option {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  min-height: 48px;
}

.practice-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.practice-option.is-correct {
  border-color: var(--blue);
  background: var(--green);
}

.practice-option.is-wrong {
  border-color: #c76a3e;
  background: #fbe8dc;
}

.practice-feedback {
  margin-top: 16px;
}

.feedback-verdict {
  font-weight: 700;
  margin: 0 0 6px;
}

.feedback-verdict.is-correct {
  color: #2f6a2f;
}

.feedback-verdict.is-wrong {
  color: #a8431e;
}

.practice-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.practice-complete {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}

.practice-complete-title {
  font-size: 28px;
}

.practice-complete-score {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue);
}

.practice-complete-note {
  opacity: 0.75;
  font-size: 14px;
  max-width: 420px;
}

.practice-complete-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .start-title {
    font-size: 44px;
  }

  .map-arrow {
    display: none;
  }

  .map-track {
    padding: 30px 16px;
  }

  .map-node {
    width: 140px;
  }

  .lesson-panel {
    padding: 16px;
  }

  .eq-big {
    font-size: 24px;
  }
}

/* ---------- DENAI game link (Bab 1 Fungsi) ---------- */

.game-link {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 16px;
  margin-top: 18px;
  width: min(360px, 100%);
  padding: 14px 18px;
  text-align: left;
  text-decoration: none;
  color: var(--navy);
  background: var(--green);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 0 var(--line);
}

.game-link-kicker {
  grid-column: 1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}

.game-link-title {
  grid-column: 1;
  font-weight: 800;
  font-size: 16px;
}

.game-link-cta {
  grid-column: 2;
  grid-row: 1 / span 2;
  font-weight: 800;
  color: #2a56b8;
}

.game-link-map {
  margin: 20px auto 0;
}

@media (prefers-reduced-motion: no-preference) {
  .game-link { transition: transform 0.12s ease; }
  .game-link:active { transform: translateY(3px); }
}

/* Elective chapters (DSKP Pakej Elektif): informational tag, not a lock. */
.map-node-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.soon-note {
  margin-top: 8px;
  font-size: 14px;
  opacity: 0.8;
}

/* =====================================================================
   Notes (Bab → subtopik pages). Long-form reading: 68ch measure, generous
   line height, sections separated by headings rather than boxes.
   ===================================================================== */
.note-screen, .chapter-screen { width: min(760px, 100%); margin: 0 auto; padding: 16px 16px 64px; box-sizing: border-box; }
.note-loading { padding: 40px 0; text-align: center; opacity: .7; }
.preview-banner { background: #FFF3C4; border: 1px solid #E5C65A; color: var(--navy); border-radius: 12px; padding: 10px 14px; margin: 8px 0 16px; font-size: 14px; }
.preview-banner code { font-size: 13px; }
.note-eyebrow { margin: 8px 0 4px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .7; }
.note-title { font-size: clamp(28px, 6vw, 40px); line-height: 1.15; margin: 0 0 8px; }
.note-time { margin: 4px 0 0; font-size: 14px; opacity: .75; }
.sp-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.sp-chip { font-size: 12px; font-weight: 700; color: var(--blue); background: #EAF0FC; border-radius: 999px; padding: 3px 9px; }
.note-toc { position: sticky; top: 0; z-index: 3; display: flex; gap: 6px; overflow-x: auto; padding: 10px 0; margin: 12px 0 4px; background: var(--cream); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.note-toc a { flex: none; font-size: 13px; font-weight: 700; color: var(--navy); text-decoration: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; }
.note-toc a:hover { border-color: var(--blue); color: var(--blue); }
.note-sec { padding: 28px 0 8px; border-bottom: 1px dashed var(--line); scroll-margin-top: 56px; font-size: 17px; line-height: 1.7; }
.note-sec p { margin: 0 0 14px; max-width: 68ch; }
.note-sec ul, .note-sec ol { padding-left: 22px; max-width: 66ch; }
.note-sec li { margin-bottom: 6px; }
.note-h2 { display: flex; flex-direction: column; gap: 2px; font-size: clamp(21px, 4.5vw, 26px); line-height: 1.25; margin: 0 0 12px; }
.note-kicker { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); }
.note-intro { font-size: 18px; }
.note-prereq { background: var(--green); border-radius: var(--radius); padding: 20px; margin-top: 20px; border: 0; }
.callout { background: var(--surface); border-left: 4px solid var(--blue); border-radius: 0 12px 12px 0; padding: 12px 16px; margin: 0 0 16px; }
.callout.is-warn { border-left-color: #D9822B; }
.callout p:last-child { margin-bottom: 0; }
.math-display { display: block; overflow-x: auto; overflow-y: hidden; padding: 4px 0; margin: 4px 0 14px; }
.katex { font-size: 1.08em; }
.mini-table { border-collapse: collapse; margin: 0 0 16px; font-size: 16px; }
.mini-table th, .mini-table td { border: 1px solid var(--line); padding: 6px 12px; text-align: center; }
.mini-table th { background: var(--surface); }
/* formulas */
.formula-list { margin: 0; display: grid; gap: 12px; }
.formula-item { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.formula-item dt { overflow-x: auto; }
.formula-item dd { margin: 4px 0 0; font-size: 15px; line-height: 1.6; }
/* visuals */
.visual-fig { margin: 8px 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.visual-fig figcaption { margin-top: 8px; font-size: 14px; }
.visual-fig summary { cursor: pointer; font-weight: 700; color: var(--blue); }
.plot-svg, .mapping-svg { display: block; width: 100%; max-width: 460px; margin: 0 auto; height: auto; }
.plot-grid { stroke: #ECE8DA; stroke-width: 1; }
.plot-axis { stroke: var(--navy); stroke-width: 1.4; }
.plot-tick { font-size: 10px; fill: var(--navy); opacity: .75; text-anchor: middle; }
.plot-tick-y { text-anchor: end; }
.plot-axis-label { font-size: 12px; font-style: italic; fill: var(--navy); }
.plot-curve { fill: none; stroke-width: 2.6; stroke-linejoin: round; }
.plot-curve.is-dashed { stroke-dasharray: 6 5; stroke-width: 1.8; }
.plot-open { fill: var(--surface); stroke-width: 2; stroke: var(--navy); }
.plot-point { fill: #D9534F; }
.plot-point-label { font-size: 12px; font-weight: 700; fill: var(--navy); }
.plot-testline { stroke: #D9822B; stroke-width: 2; stroke-dasharray: 4 4; }
.plot-shade { fill: #3467D433; }
.plot-controls { display: grid; gap: 10px; margin: 10px auto 0; max-width: 460px; }
.plot-param label { display: block; font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.plot-param input[type=range] { width: 100%; accent-color: var(--blue); min-height: 32px; }
.plot-readout { max-width: 460px; margin: 10px auto 0; font-size: 15px; line-height: 1.6; background: #F4F7FD; border-radius: 12px; padding: 10px 14px; }
.plot-readout:empty { display: none; }
.mapping-oval { fill: #F4F7FD; stroke: var(--line); }
.mapping-label { font-size: 15px; font-weight: 700; fill: var(--navy); text-anchor: middle; }
.mapping-arrow-line { stroke: var(--blue); stroke-width: 1.8; }
.mapping-head { fill: var(--blue); }
.mapping-note { max-width: 460px; margin: 8px auto 0; font-size: 15px; }
.mapping-stage + .mapping-note:empty { display: none; }
.value-table-wrap { overflow-x: auto; }
.value-table { border-collapse: collapse; margin: 0 auto; font-size: 15px; }
.value-table th, .value-table td { border: 1px solid var(--line); padding: 6px 14px; text-align: center; }
.value-table th { background: #F4F7FD; }
.value-table-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center; margin-top: 10px; font-size: 14px; }
.value-table-add input { width: 110px; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; font-size: 16px; }
/* worked examples */
.example { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 18px; }
.example-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.example-num { font-weight: 800; color: var(--blue); }
.example-q { font-weight: 600; margin-bottom: 10px; }
.example-frame { display: grid; gap: 6px; margin: 0 0 12px; font-size: 15px; }
.example-frame div { display: grid; grid-template-columns: 76px 1fr; gap: 8px; }
.example-frame dt { font-weight: 800; opacity: .75; }
.example-frame dd { margin: 0; }
.example-steps { padding-left: 22px; margin: 0 0 10px; }
.example-steps li { margin-bottom: 12px; }
.step-do { overflow-x: auto; }
.step-why { font-size: 14.5px; line-height: 1.55; background: #F6F4EB; border-radius: 10px; padding: 6px 10px; margin-top: 4px; }
.step-why span { font-weight: 800; color: var(--blue); }
.example-check, .example-conclusion { font-size: 15.5px; margin: 6px 0 0 !important; }
/* mistakes */
.mistake { border-radius: 14px; background: var(--surface); border: 1px solid var(--line); padding: 12px 16px; margin-bottom: 12px; font-size: 16px; }
.mistake p { margin: 0 0 6px !important; }
.mistake-wrong span { color: #C0392B; font-weight: 800; }
.mistake-fix span { color: #2E9E6B; font-weight: 800; }
.note-summary ul { background: var(--green); border-radius: var(--radius); padding: 16px 16px 16px 36px; }
.next-links { display: flex; flex-wrap: wrap; gap: 8px; }
.next-links .btn-ghost { text-decoration: none; }
.note-pager { margin-top: 28px; }
.note-pager .btn-primary { width: 100%; white-space: normal; text-align: center; }
/* practice */
.q-list { display: grid; gap: 16px; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 3px 0 var(--line); }
.q-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 8px !important; font-size: 13px; }
.q-num { font-weight: 800; margin-right: 4px; }
.q-tag { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 9px; background: #F1EEE3; }
.q-mudah { background: #E3F4EA; color: #1F6E47; } .q-sederhana { background: #FFF1D6; color: #8A5A00; } .q-mencabar { background: #FBE3E1; color: #9B2C24; }
.q-prompt { margin-bottom: 12px; }
.q-options { display: grid; gap: 8px; }
.q-option { display: flex; gap: 10px; align-items: center; text-align: left; width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--cream); color: var(--navy); font-size: 16px; }
.q-option.is-right { border-color: #2E9E6B; background: #E3F4EA; } .q-option.is-wrong { border-color: #D9534F; background: #FBE3E1; }
.q-letter { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface); border: 1px solid var(--line); }
.q-input-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.q-input { flex: 1 1 160px; min-width: 0; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; font-size: 17px; color: var(--navy); background: #fff; }
.q-unit { font-size: 15px; }
.q-feedback { margin-top: 8px; font-size: 15.5px; line-height: 1.55; border-radius: 10px; }
.q-feedback:empty { display: none; }
.q-feedback.is-right { background: #E3F4EA; padding: 8px 12px; } .q-feedback.is-wrong { background: #FBE3E1; padding: 8px 12px; } .q-feedback.is-invalid, .q-feedback.is-empty { background: #FFF3C4; padding: 8px 12px; }
.q-part { margin-bottom: 12px; } .q-part-prompt { margin-bottom: 6px !important; }
.q-self { font-size: 15px; opacity: .8; }
.q-solution { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.q-solution summary { cursor: pointer; font-weight: 800; color: var(--blue); min-height: 32px; }
.q-solution ol { padding-left: 22px; margin: 8px 0 0; font-size: 15.5px; }
.q-sol-part { margin: 8px 0 0 !important; }
/* chapter overview */
.chapter-header { margin: 8px 0 16px; }
.chapter-intro { font-size: 17px; line-height: 1.65; }
.sub-list { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.sub-card { width: 100%; text-align: left; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: 0 3px 0 var(--line); color: var(--navy); }
.sub-num { grid-row: span 3; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; color: var(--blue); }
.sub-title { font-weight: 800; font-size: 17px; }
.sub-sp, .sub-time { font-size: 13px; opacity: .75; }
.chapter-extra { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.map-node-status.is-review { background: #FFF3C4; opacity: 1; }
@media (prefers-reduced-motion: no-preference) { .note-toc { scroll-behavior: smooth; } }
.note-toc a { max-width: 15em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plot-axisline { stroke: #7B4FC9; stroke-width: 1.6; stroke-dasharray: 3 4; }

.plot-polygon { fill: #3467D422; stroke-width: 2.2; stroke-linejoin: round; }
.plot-segment { fill: none; stroke-width: 2.6; }
.plot-arrow { stroke-width: 2.8; }
.plot-arrow.is-dashed { stroke-dasharray: 6 4; stroke-width: 2; }

/* ===================== V3: student-first notes (Fahami / Ulang Kaji / Latihan) ===================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.v3-screen { width: min(760px, 100%); margin: 0 auto; padding: 12px 16px 56px; box-sizing: border-box; color: var(--navy); }
.v3-screen.v3-with-side { width: min(1080px, 100%); display: block; }
.v3-side { display: none; }
@media (min-width: 1000px) {
  .v3-screen.v3-with-side { display: grid; grid-template-columns: 240px minmax(0, 720px); gap: 32px; align-items: start; }
  .v3-with-side > .preview-banner { grid-column: 1 / -1; }
  .v3-side { display: block; position: sticky; top: 12px; font-size: 14px; line-height: 1.4; }
  .v3-side ol { list-style: none; margin: 0; padding: 0; }
  .v3-side a { display: grid; grid-template-columns: 34px 1fr; padding: 7px 8px; border-radius: 10px; color: var(--navy); text-decoration: none; }
  .v3-side a:hover { background: var(--green); }
  .v3-side a[aria-current] { background: var(--navy); color: #fff; }
  .v3-side-head { font-weight: 700; margin: 4px 8px 10px; }
  .v3-picker { display: none; }
}
.v3-main { min-width: 0; }
.v3-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.v3-back { color: var(--navy); font-weight: 600; text-decoration: none; font-size: 15px; display: inline-block; margin-bottom: 6px; }
.v3-picker select, .v3-filters select { max-width: 60vw; font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--navy); }
.v3-head { margin: 4px 0 10px; }
.v3-title { font-size: clamp(24px, 5vw, 32px); line-height: 1.2; margin: 2px 0 0; }
.mode-tabs { display: flex; gap: 4px; padding: 4px; margin: 4px 0 14px; background: var(--green); border-radius: 12px; }
.mode-tab { flex: 1; text-align: center; padding: 8px 6px; border-radius: 9px; font-weight: 700; font-size: 15px; color: var(--navy); text-decoration: none; }
.mode-tab.is-active { background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.v3-block { padding: 16px 0 6px; border-top: 1px solid var(--line); font-size: 17px; line-height: 1.65; scroll-margin-top: 12px; }
.v3-block:first-of-type { border-top: 0; }
.v3-block h2 { font-size: 15px; letter-spacing: .04em; text-transform: uppercase; color: var(--blue); margin: 0 0 8px; }
.v3-block p { margin: 0 0 10px; max-width: 68ch; }
.v3-idea { font-size: 18px; }
.v3-when { background: var(--green); border-radius: 10px; padding: 8px 12px; }
.v3-formulas { margin: 0; display: grid; gap: 8px; }
.v3-formula { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; overflow-x: auto; }
.v3-formula dt { margin: 0 0 4px; }
.v3-formula dd { margin: 0; font-size: 15px; line-height: 1.5; }
.v3-howto { margin: 0; padding-left: 22px; }
.v3-howto li { margin-bottom: 4px; }
.v3-example { border-left: 4px solid var(--blue); padding: 4px 0 4px 14px; margin: 6px 0 12px; }
.v3-example-head { display: flex; gap: 8px; align-items: center; font-weight: 700; margin: 0 0 4px; }
.v3-example-q { font-weight: 600; margin-bottom: 6px; }
.v3-example-plan { font-size: 15px; color: #4b5872; }
.v3-steps { margin: 0 0 8px; padding-left: 22px; }
.v3-steps li { margin-bottom: 6px; }
.v3-step-why { font-size: 14.5px; color: #4b5872; border-left: 2px solid var(--line); padding-left: 8px; margin-top: 2px; }
.v3-example-check, .v3-example-end { font-size: 15.5px; margin: 0 0 4px; }
.v3-mistake p { margin: 0 0 4px; }
.v3-wrong { color: #A33A2E; } .v3-fix { color: #2B6E4A; }
.v3-mistake + .v3-mistake { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 8px; }
.v3-optional { display: grid; gap: 8px; }
.v3-more { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.v3-more > summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 15.5px; }
.v3-more-body { padding: 0 14px 10px; font-size: 16px; }
.v3-more-body h3, .v3-deep h3 { font-size: 16px; margin: 12px 0 6px; }
.v3-end { margin-top: 18px; display: grid; gap: 10px; }
.v3-end .btn-primary { text-align: center; text-decoration: none; white-space: normal; }
.v3-end-links { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; margin: 0; }
.v3-end-links a { color: var(--blue); text-decoration: none; }
.v3-visual-note { font-size: 15.5px; }
/* chapter overview */
.v3-sublist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.v3-subrow { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.v3-subrow-main { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 12px 14px 6px; color: var(--navy); text-decoration: none; }
.v3-subnum { font-weight: 800; color: var(--blue); grid-row: span 2; }
.v3-subtitle { font-weight: 700; }
.v3-sublead { font-size: 14.5px; color: #4b5872; line-height: 1.45; }
.v3-subrow-actions { display: flex; gap: 16px; padding: 0 14px 10px 48px; font-size: 14.5px; font-weight: 700; }
.v3-subrow-actions a { color: var(--blue); text-decoration: none; }
.v3-chapter-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.v3-chapter-links a { text-decoration: none; }
/* revision */
.v3-rev-tools { position: sticky; top: 0; z-index: 2; background: var(--cream); padding: 6px 0 8px; display: grid; gap: 6px; }
.v3-search input { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.v3-chips { display: flex; gap: 6px; overflow-x: auto; }
.v3-chips a { flex: none; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--navy); font-size: 14px; font-weight: 700; text-decoration: none; }
.v3-rev { padding: 14px 0 6px; border-top: 1px solid var(--line); scroll-margin-top: 96px; font-size: 16px; line-height: 1.55; }
.v3-rev h2 { font-size: 18px; margin: 0 0 8px; } .v3-rev h2 span { color: var(--blue); }
.v3-rev-line { margin: 8px 0 2px; }
.v3-rev-steps, .v3-rev-mistakes { margin: 0; padding-left: 22px; }
.v3-rev-mistakes { list-style: none; padding-left: 0; }
.v3-rev-mistakes li { margin-bottom: 4px; }
.v3-x { color: #A33A2E; } .v3-ok { color: #2B6E4A; } .v3-arrow { color: #8a93a6; }
.v3-rev-links { display: flex; gap: 16px; font-size: 14.5px; font-weight: 700; } .v3-rev-links a { color: var(--blue); text-decoration: none; }
.v3-empty { color: #4b5872; }
/* practice */
.v3-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 14.5px; font-weight: 600; }
.v3-levels { display: flex; gap: 4px; }
.v3-levels button { font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--navy); }
.v3-levels button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.v3-qpicker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.v3-qpicker button { min-width: 38px; height: 38px; font: inherit; font-weight: 700; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--navy); }
.v3-qpicker button.is-current { outline: 3px solid var(--blue); outline-offset: 1px; }
.v3-qpicker button.is-right { background: #DDF0E2; border-color: #7DBB92; }
.v3-qpicker button.is-tried { background: #FBEBD2; border-color: #E0B46E; }
.q-reveal { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--green); font-size: 15.5px; }
.q-reveal a { color: var(--blue); font-weight: 700; text-decoration: none; }
.q-answers { margin: 4px 0 6px; padding-left: 20px; }
.q-done { margin-top: 6px; }
.v3-screen .visual-fig { margin: 4px 0 0; }
.v3-screen .katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.v3-revision .v3-formula { padding: 4px 10px; border-radius: 10px; }
.v3-revision .v3-formula .katex-display { margin: 0.15em 0; font-size: 0.92em; }
.v3-revision .v3-formula dd { font-size: 14px; }
.v3-revision .v3-formulas { gap: 6px; }

/* M-5: bar linking every notes screen to the matching DENAI Learning Hub page. */
.hub-bar { background: #10233d; color: #eef3fb; font-size: 13px; line-height: 1.45; }
.hub-bar p { max-width: 1100px; margin: 0 auto; padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.hub-bar-link { color: #ffd66b; font-weight: 700; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; display: inline-flex; align-items: center; }
.hub-bar-link:hover { color: #fff; }
.hub-bar-link:focus-visible { outline: 2px solid #ffd66b; outline-offset: 2px; border-radius: 3px; }
@media (max-width: 599px) { .hub-bar { font-size: 12px; } }
@media print { .hub-bar { display: none; } }
