/* =========================================================
   Workbook — Exercise & Progress Styles
   Shared across all workbook pages.
   ========================================================= */

/* ── Exercise Inputs ─────────────────────────────────────── */
.ex-input{display:flex;gap:.5rem;align-items:center;margin:.8rem 0;flex-wrap:wrap}
.ex-input input[type="number"],.ex-input input[type="text"]{
  width:140px;padding:.5rem;background:var(--bg3);border:1px solid var(--border);
  border-radius:6px;color:var(--text);font-family:'IBM Plex Mono',monospace;font-size:.85rem;
  transition:border-color .2s
}
.ex-input input:focus{outline:none;border-color:var(--warm)}
.ex-input .unit{color:var(--text3);font-size:.85rem;font-family:'IBM Plex Mono',monospace}
.ex-fb{font-size:.85rem;margin:.5rem 0;min-height:1.2em}
.ex-reveal{margin-top:.5rem}
.ex-reveal summary{color:var(--warm);cursor:pointer;font-size:.85rem;font-family:'Outfit',sans-serif}
.ex-reveal summary:hover{color:var(--warm2)}
.ex-reveal .deriv{margin-top:.5rem;padding:.8rem 1rem;background:var(--bg3);border-radius:8px;font-size:.88rem;line-height:1.8}

/* ── Equation Display ────────────────────────────────────── */
.eq{font-family:'IBM Plex Mono',monospace;font-size:.82rem;background:var(--bg3);border-radius:8px;padding:.8rem 1rem;margin:.8rem 0;line-height:1.7;overflow-x:auto;color:var(--text2)}
.eq .cm{color:var(--text4);font-size:.72rem}

/* ── Code Editor ─────────────────────────────────────────── */
.code-editor{position:relative;margin:.8rem 0}
.code-editor textarea{
  width:100%;min-height:120px;padding:.8rem;background:var(--bg3);border:1px solid var(--border);
  border-radius:8px;color:var(--text);font-family:'IBM Plex Mono',monospace;font-size:.82rem;
  line-height:1.6;resize:vertical;tab-size:2;white-space:pre;overflow-x:auto
}
.code-editor textarea:focus{outline:none;border-color:var(--teal)}
.code-editor .code-hint{font-size:.78rem;color:var(--text4);margin-top:.3rem}
.code-tests{margin:.5rem 0;font-size:.82rem}
.code-tests .test-case{
  display:flex;align-items:center;gap:.5rem;padding:.3rem .6rem;
  border-radius:4px;margin:.2rem 0;font-family:'IBM Plex Mono',monospace
}
.code-tests .test-case.pass{background:rgba(92,232,142,.08);color:var(--green)}
.code-tests .test-case.fail{background:rgba(232,106,106,.08);color:var(--red)}
.code-tests .test-case.pending{background:var(--bg3);color:var(--text4)}

/* ── Debug Exercise ──────────────────────────────────────── */
.debug-code{margin:.8rem 0}
.debug-code pre{
  background:var(--bg3);border-radius:8px;padding:.8rem 1rem;margin:0;
  font-family:'IBM Plex Mono',monospace;font-size:.82rem;line-height:1.8;overflow-x:auto;
  counter-reset:debug-line
}
.debug-code .dl{
  display:block;padding:1px 0;cursor:pointer;border-radius:3px;
  padding-left:.5rem;margin-left:-.5rem;padding-right:.5rem;margin-right:-.5rem;
  transition:background .15s
}
.debug-code .dl::before{
  counter-increment:debug-line;content:counter(debug-line);
  display:inline-block;width:2em;text-align:right;margin-right:1em;
  color:var(--text4);font-size:.75rem;user-select:none
}
.debug-code .dl:hover{background:rgba(232,168,124,.06)}
.debug-code .dl.selected{background:rgba(232,106,106,.12);border-left:2px solid var(--red)}
.debug-code .dl.correct{background:rgba(92,232,142,.1);border-left:2px solid var(--green)}

/* ── Design Exercise (fill-in pipeline) ──────────────────── */
.design-slots{display:flex;flex-wrap:wrap;gap:.5rem;margin:.8rem 0;align-items:center}
.design-slot{
  min-width:80px;padding:.4rem .6rem;background:var(--bg3);border:1.5px dashed var(--border2,var(--border));
  border-radius:6px;text-align:center;font-size:.82rem;color:var(--text3);font-family:'IBM Plex Mono',monospace
}
.design-slot.filled{border-style:solid;border-color:var(--teal);color:var(--text)}
.design-slot.wrong{border-color:var(--red);color:var(--red)}
.design-arrow{color:var(--text4);font-size:1.1rem}
.design-bank{display:flex;flex-wrap:wrap;gap:.4rem;margin:.5rem 0}
.design-chip{
  padding:.3rem .6rem;background:var(--surface);border:1px solid var(--border);
  border-radius:5px;font-size:.8rem;color:var(--text2);cursor:pointer;
  font-family:'IBM Plex Mono',monospace;transition:all .15s;user-select:none
}
.design-chip:hover{border-color:var(--warm);color:var(--warm)}
.design-chip.used{opacity:.35;pointer-events:none}

/* ── Streak & Progress ───────────────────────────────────── */
.wb-progress{
  display:flex;align-items:center;gap:1rem;padding:.8rem 1rem;
  background:var(--bg3);border-radius:10px;margin:1rem 0;flex-wrap:wrap
}
.wb-mastery{flex:1;min-width:150px}
.wb-mastery-label{font-size:.78rem;color:var(--text3);margin-bottom:.3rem;font-family:'Outfit',sans-serif}
.wb-mastery-bar{height:6px;background:var(--bg);border-radius:3px;overflow:hidden}
.wb-mastery-fill{height:100%;background:linear-gradient(90deg,var(--warm),var(--teal));border-radius:3px;transition:width .5s ease}
.wb-mastery-pct{font-size:.75rem;color:var(--text4);margin-top:.2rem;font-family:'IBM Plex Mono',monospace}
.wb-streak{text-align:center;min-width:70px}
.wb-streak-n{font-size:1.4rem;font-weight:700;color:var(--warm);font-family:'Outfit',sans-serif}
.wb-streak-n.on-fire{color:var(--yellow);text-shadow:0 0 12px rgba(232,208,106,.3)}
.wb-streak-label{font-size:.72rem;color:var(--text4);font-family:'Outfit',sans-serif}

/* ── Checklist ───────────────────────────────────────────── */
.checklist{list-style:none;padding:0;margin:1rem 0}
.checklist li{padding:.4rem 0;font-size:.95rem;display:flex;align-items:flex-start;gap:.5rem}
.checklist li::before{
  content:'';display:inline-block;width:18px;height:18px;min-width:18px;
  border:2px solid var(--border2,var(--border));border-radius:4px;margin-top:3px;cursor:pointer
}
.checklist li.done::before{
  background:var(--green);border-color:var(--green);
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 8l3 3 7-7' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size:12px;background-position:center;background-repeat:no-repeat
}

/* ── Score Bar (legacy compat) ───────────────────────────── */
.score-bar{height:6px;background:var(--bg3);border-radius:3px;margin:.5rem 0;overflow:hidden}
.score-fill{height:100%;background:linear-gradient(90deg,var(--warm),var(--teal));border-radius:3px;transition:width .5s ease}

/* ── Exercise Mode Badges ────────────────────────────────── */
.ex-mode{
  display:inline-block;font-size:.65rem;font-weight:600;text-transform:uppercase;
  letter-spacing:.06em;padding:.15rem .4rem;border-radius:3px;
  font-family:'Outfit',sans-serif;vertical-align:middle;margin-left:.4rem
}
.ex-mode.derive{background:rgba(176,122,255,.15);color:var(--purple)}
.ex-mode.trace{background:rgba(107,158,255,.15);color:var(--blue)}
.ex-mode.build{background:rgba(92,201,181,.15);color:var(--teal)}
.ex-mode.design{background:rgba(232,168,124,.15);color:var(--warm)}
.ex-mode.debug{background:rgba(232,106,106,.15);color:var(--red)}

/* ── Responsive ──────────────────────────────────────────── */
@media(max-width:600px){
  .wb-progress{flex-direction:column;align-items:stretch}
  .wb-streak{text-align:left;display:flex;align-items:center;gap:.5rem}
  .design-slots{flex-direction:column}
  .ex-input input[type="number"],.ex-input input[type="text"]{width:100px}
}
