html{scroll-padding-top:calc(var(--appbar-h) + 12px)}
/* Design tokens: one place for the core palette, spacing and shape. */
:root{
  --bg:#f4f7fc;--surface:#fff;--surface-2:#f3f7fd;--surface-3:#eaf2fc;
  --text:#172b44;--muted:#5b6d85;--border:#dce7f4;--border-strong:#b6c5d6;
  --primary:#2465b1;--primary-hover:#184f95;--accent:#245a96;--accent-strong:#1b568c;
  --success:#15724f;--success-bg:#e7f7ef;--danger:#b73127;--danger-bg:#feebea;--warning:#9d4815;
  --hero-from:#10203b;--hero-to:#1c5987;--appbar:#0d1b31;
  --focus:#74aaf0;--ink-diagram:#194c89;--sig-high:#15724f;--sig-low:#194c89;--sig-undef:#98621f;--radius:16px;--radius-sm:9px;--shadow:0 6px 22px #1e36500c;
  --appbar-h:60px;
}

/* Application bar and grouped navigation */
.skip-link{position:absolute;left:12px;top:-60px;z-index:60;background:var(--surface);color:var(--primary);padding:10px 14px;border-radius:var(--radius-sm);font-weight:700}
.skip-link:focus{top:10px}
.page-body:focus{outline:none}
.app-bar{position:sticky;top:0;z-index:40;background:var(--appbar);color:#fff;box-shadow:0 1px 0 #ffffff14,0 6px 18px #0b16290f}
.app-bar-inner{max-width:1130px;margin:auto;padding:0 16px;min-height:var(--appbar-h);display:flex;align-items:center;gap:18px}
.app-brand{color:#fff;text-decoration:none;font-weight:800;font-size:20px;white-space:nowrap;display:flex;align-items:center;gap:9px}
.app-brand-mark{display:block;width:28px;height:28px;border-radius:7px;box-shadow:0 0 0 1px #ffffff26}
.app-brand:focus-visible,.nav-top-link:focus-visible,.nav-link:focus-visible{outline:3px solid var(--focus);outline-offset:2px;border-radius:6px}
.site-nav{display:flex;align-items:center;gap:4px;margin-left:auto}
.nav-section{position:relative}
.nav-section-button,.nav-top-link{background:transparent;border:1px solid transparent;color:#dbe7f5;font-weight:700;font-size:15px;padding:8px 12px;border-radius:var(--radius-sm);text-decoration:none;display:inline-flex;align-items:center;gap:6px;cursor:pointer}
.nav-section-button:hover:not(:disabled),.nav-top-link:hover{background:#ffffff14;border-color:transparent;color:#fff}
.nav-section.current>.nav-section-button,.nav-top-link.current{color:#fff;background:#ffffff1c;box-shadow:inset 0 -3px 0 #8cc1ff}
.nav-section.open>.nav-section-button{background:#ffffff24;color:#fff}
.nav-caret{font-size:11px;transition:transform .15s}
.nav-section.open .nav-caret{transform:rotate(180deg)}
.nav-menu{display:none;position:absolute;right:0;top:calc(100% + 8px);z-index:45;min-width:310px;list-style:none;margin:0;padding:8px;background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:0 18px 40px #0b1a3333}
.nav-section.open .nav-menu{display:block}
.nav-link{display:flex;flex-direction:column;gap:2px;padding:10px 12px;border-radius:10px;color:var(--text);text-decoration:none}
.nav-link strong{font-size:15px}
.nav-link small{color:var(--muted);font-size:13px}
.nav-link:hover{background:var(--surface-2)}
.nav-link.current{background:var(--surface-3);box-shadow:inset 3px 0 0 var(--primary)}
.nav-link.current strong{color:var(--primary)}
.nav-backdrop{position:fixed;inset:0;z-index:35;background:transparent}
.nav-toggle{display:none;margin-left:auto;background:#ffffff14;border:1px solid #ffffff33;color:#fff;font-weight:700;padding:8px 12px;gap:8px;align-items:center}
.nav-toggle:hover:not(:disabled){background:#ffffff24;border-color:#ffffff55}
@media(max-width:900px){
  .nav-toggle{display:inline-flex}
  .site-nav{display:none;position:absolute;left:0;right:0;top:100%;flex-direction:column;align-items:stretch;gap:2px;margin:0;padding:10px 16px 18px;background:var(--appbar);max-height:calc(100vh - var(--appbar-h));overflow:auto;box-shadow:0 18px 30px #0b16294d}
  .site-nav.open{display:flex}
  .nav-section-button{width:100%;justify-content:flex-start;pointer-events:none;color:#8fa9c8;font-size:12px;text-transform:uppercase;letter-spacing:.7px;padding:12px 4px 4px;box-shadow:none!important;background:transparent!important}
  .nav-caret{display:none}
  .nav-menu{display:block;position:static;min-width:0;padding:0;background:transparent;border:0;box-shadow:none}
  .nav-link{color:#fff;padding:9px 10px}
  .nav-link small{color:#a9bdd6}
  .nav-link:hover{background:#ffffff14}
  .nav-link.current{background:#ffffff1f;box-shadow:inset 3px 0 0 #8cc1ff}
  .nav-link.current strong{color:#fff}
  .nav-top-link{padding:12px 10px;margin-top:8px;border-top:1px solid #ffffff1f;border-radius:0}
  .nav-top-link.current{box-shadow:inset 3px 0 0 #8cc1ff}
  .nav-backdrop{display:none}
}
@media print{.app-bar,.skip-link{display:none!important}}

*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:16px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif}button,select{font:inherit}.hero{background:linear-gradient(118deg,var(--hero-from),var(--hero-to));color:#fff;padding:26px 20px 56px}.hero-inner{max-width:1110px;margin:auto}.eyebrow{display:inline-block;background:#ffffff1f;border:1px solid #ffffff33;padding:4px 11px;border-radius:999px;font-size:13px;font-weight:700;letter-spacing:.2px;color:#e8f0fa}.hero h1{margin:6px 0 6px;font-size:clamp(25px,4vw,40px);line-height:1.15;text-wrap:balance}.hero p{margin:0;color:#e2ebf6;max-width:72ch}.shell{max-width:1130px;margin:-32px auto 50px;padding:0 16px}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:18px}.stat,.panel{background:var(--surface);border:1px solid var(--border);border-radius:16px;box-shadow:0 6px 22px #1e36500c}.stat{padding:16px;display:flex;flex-direction:column}.stat-value{font-size:29px;font-weight:800;color:var(--accent-strong)}.stat span:last-child{color:var(--muted);font-size:13px}.panel{padding:22px;margin-bottom:18px;--panel-bg:var(--surface)}.panel h2{margin:0;font-size:21px}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;flex-wrap:wrap}.tag{background:#eaf2fc;color:var(--accent);font-weight:700;border-radius:30px;padding:5px 12px;font-size:12px}.toolbar,.footer-actions{display:flex;align-items:flex-end;flex-wrap:wrap;gap:12px}.toolbar label{display:flex;flex-direction:column;gap:7px;font-weight:700;min-width:200px}.toolbar select{padding:11px 12px;border-radius:9px;border:1px solid var(--border-strong);background:var(--surface);min-width:200px}.toolbar button{margin-bottom:1px}button{border:1px solid var(--border-strong);border-radius:9px;background:var(--surface);color:#234263;padding:10px 15px;cursor:pointer}button:hover:not(:disabled){border-color:#2567ac;background:#edf5ff}button:focus-visible,select:focus-visible{outline:3px solid #74aaf0;outline-offset:2px}button:disabled{opacity:.65;cursor:not-allowed}.primary,.choice button.chosen{background:var(--primary);color:white;border-color:var(--primary)}.primary:hover:not(:disabled){background:var(--primary-hover)}.muted{color:var(--muted)}.hint{margin:13px 0;font-size:14px}.warning{color:#9d4815}.diagram-scroll{overflow:auto}.circuit{width:100%;max-height:480px;display:block;margin:0 auto;color:#233f5b}.gate-text{font-size:13px;font-weight:800;fill:#2a5b93;stroke:none}.wire-label{font-size:19px;font-weight:700;fill:#13835e;stroke:none}.formulas{display:flex;justify-content:center;flex-wrap:wrap;gap:8px}.formulas span{background:#edf3f9;padding:7px 10px;border-radius:9px;font-weight:700;font-size:14px}.counter{font-variant-numeric:tabular-nums;color:#2867ab}.progress{height:6px;background:#e5eaf3;border-radius:20px;overflow:hidden;margin:14px 0}.progress div{height:100%;background:var(--primary);transition:width .15s}.table-scroll{overflow-x:auto}table{width:100%;border-collapse:collapse;text-align:center}th,td{border-bottom:1px solid #e6edf3;padding:8px 5px}th{background:#f1f5fa;position:sticky;top:0;z-index:1}.output{color:#155da9}.choice{display:flex;justify-content:center;gap:4px}.choice button{padding:7px 13px;min-width:42px}.answer-cell.correct{background:#e7f7ef}.answer-cell.incorrect{background:#feebea}.answer-cell small{font-weight:800;display:block;margin-top:4px}.footer-actions{margin-top:16px}.result{margin-top:14px;padding:13px;background:#eaf4fc;border-radius:9px;display:flex;flex-wrap:wrap;gap:12px}.topic-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px}.topic{padding:11px;border:1px solid var(--border);border-radius:10px;display:flex;flex-direction:column}.topic span{font-size:13px;color:var(--muted)}.error-page{margin:80px auto}footer{text-align:center;color:#73839b;font-size:13px}@media(max-width:640px){.stats{gap:6px}.stat{padding:10px}.stat-value{font-size:22px}.panel{padding:15px}.choice button{min-width:34px;padding:6px 8px}.toolbar label,.toolbar select{min-width:100%;width:100%}.toolbar{align-items:stretch}}
.pagination{display:flex;gap:12px;align-items:center;justify-content:center;flex-wrap:wrap;margin-top:16px;padding:12px;background:#f3f7fd;border-radius:10px}.pagination span{font-size:14px;font-weight:650;color:#445f7e}.pagination button{min-width:120px}@media(max-width:640px){.pagination button{min-width:0;padding:8px}}

/* Adaptive training */
.adaptive-controls{margin-top:18px;padding:14px;border:1px solid #cadbea;border-radius:12px;background:#f1f7fe;display:flex;align-items:center;flex-wrap:wrap;gap:12px}
.adaptive-toggle{display:inline-flex;gap:9px;align-items:center;cursor:pointer}
.adaptive-toggle input{width:20px;height:20px;accent-color:var(--primary)}
.adaptive-target{margin:10px 0 0;color:#225e9a}
.adaptive-details{margin-top:14px}
.adaptive-details summary{font-weight:750;color:var(--accent);cursor:pointer;padding:6px 0}
.adaptive-details .topic-grid{margin-top:10px;margin-bottom:10px}
.topic small{font-weight:700;color:#3b6c93;margin-top:5px}

/* Exam mode */
.exam-header-nav{margin-top:18px}
.exam-header-nav a{display:inline-block;color:#fff;font-weight:750;text-underline-offset:3px}
.exam-clock{font-variant-numeric:tabular-nums;font-size:27px;color:var(--accent-strong);letter-spacing:1px}
.exam-clock-warning{color:#b73127}
.exam-toolbar{display:flex;flex-wrap:wrap;gap:12px;color:var(--muted);font-size:14px;font-weight:650}
.exam-question-nav{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0 18px}
.exam-question-nav button{min-width:42px}
.exam-question-nav button.chosen{background:var(--primary);border-color:var(--primary);color:white}
.exam-results{display:grid;grid-template-columns:repeat(auto-fit,minmax(185px,1fr));gap:10px;margin-top:12px}
.exam-results div{border:1px solid var(--border);border-radius:10px;padding:12px;display:flex;flex-direction:column;gap:4px}
.exam-results span{color:#587087;font-size:13px}
.exam-link{padding:10px 4px;color:var(--accent-strong);font-weight:700}
@media print{
  .hero,.exam-header-nav,.exam-question-nav,.pagination,.footer-actions,.exam-history,button,footer{display:none!important}
  body{background:var(--surface);color:black;font-size:12px}
  .shell{max-width:none;margin:0}
  .panel{box-shadow:none;break-inside:avoid;border:1px solid #aaa}
  .diagram-scroll{max-height:350px}
  .circuit{max-height:300px}
  .answer-cell.correct{background:#e7f7ef!important}
  .answer-cell.incorrect{background:#feebea!important}
}

/* Digital-logic curriculum: reusable teaching blocks */
.logic-formula{background:#eff5fd;border-left:4px solid var(--primary);padding:12px 16px;border-radius:6px;overflow-wrap:anywhere;font-weight:600}
.logic-device{display:grid;grid-template-columns:minmax(0,1fr) minmax(165px,1.2fr) minmax(0,1fr);align-items:center;gap:14px;padding:20px 12px;background:#f5f8fd;border:1px solid var(--border);border-radius:14px}
.logic-device-ports{display:flex;flex-direction:column;gap:7px;min-width:0}
.logic-port{display:flex;align-items:center;gap:7px;padding:7px 8px;border:1px solid #cbd8e7;border-radius:8px;background:var(--surface);min-width:0;flex-wrap:wrap}
.logic-port span{font-weight:650;color:#304e74}
.logic-port input{width:19px;height:19px;accent-color:var(--primary);margin-left:auto}
.logic-port strong{font-variant-numeric:tabular-nums;min-width:17px;text-align:center;color:var(--accent-strong)}
.logic-output strong{margin-left:auto;font-size:18px}
.logic-device-core{border:3px solid var(--accent);border-radius:9px;min-height:114px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:9px;padding:12px;background:var(--surface);color:#1d477c}
.logic-device-core small{color:var(--muted)}
.logic-result-note{padding:11px 14px;background:#eef7f2;border:1px solid #d1e7d9;border-radius:10px;font-weight:600}
.logic-current-row td{background:#e3f1ff;outline:1px solid #c1dcfc}
.logic-table-note{text-align:left;font-size:13px;color:var(--muted);min-width:150px}
.counter-display{margin:14px 0;padding:19px;background:#ecf3fb;border:1px solid #c9dbee;border-radius:14px;display:grid;gap:9px}
.counter-bits{display:flex;justify-content:center;gap:9px;flex-wrap:wrap}
.counter-bit{border:1px solid #b8cce0;border-radius:10px;background:var(--surface);min-width:67px;text-align:center;padding:8px 10px;display:flex;flex-direction:column;gap:5px}
.counter-bit span{font-size:13px;color:#58708a}
.counter-bit strong{font-size:29px;color:#1f5899;font-variant-numeric:tabular-nums}
.counter-decimal{font-size:16px;text-align:center}
@media(max-width:650px){
 .logic-device{grid-template-columns:minmax(0,1fr);gap:10px}
 .logic-device-ports{flex-direction:row;flex-wrap:wrap}
 .logic-port{flex:1 1 95px}
 .logic-device-core{min-height:84px}
 .counter-bit{min-width:54px;padding:6px}
}

/* Lecture study notes and BCD visualisation */
.lecture-select-label{display:flex;flex-direction:column;gap:6px;font-weight:700}
.lecture-select-label select{padding:11px 12px;border-radius:9px;border:1px solid var(--border-strong);background:var(--surface);width:100%;max-width:720px}
.lecture-topic{padding-top:10px}
.lecture-topic h2{margin:14px 0 16px;font-size:23px}
.lecture-topic h3{font-size:16px;margin:0 0 8px}
.lecture-topic>div{padding:17px;margin-bottom:12px;border-radius:11px;border:1px solid var(--border)}
.lecture-topic>div p{margin:0}
.lecture-notes-source{background:#f1f6ff}
.lecture-explanation{background:#fbf8ef}
.lecture-example{background:#f0f8f2}
.lecture-topic details{margin:16px 0}
.lecture-topic summary{font-weight:650;cursor:pointer;color:#1c5285}
.seven-segment-demo{display:flex;align-items:center;gap:25px;padding:18px;margin:16px 0;background:#f4f7fc;border:1px solid var(--border);border-radius:12px}
.seven-segment-demo svg{width:130px;min-width:100px;max-height:220px}
.seven-segment-demo p{max-width:520px}
@media(max-width:500px){.seven-segment-demo{gap:12px}.seven-segment-demo svg{width:95px;min-width:80px}}

/* Verified course figures: generated from typed simulator data, not AI bitmap text. */
.verified-schematic{margin:18px 0;padding:12px 14px;border-radius:12px;border:1px solid #ccdae9;background:#f8fbff}
.verified-schematic svg{display:block;width:100%;height:auto;max-height:455px;overflow:visible}
.verified-schematic figcaption{margin:6px 2px 0;color:var(--muted);font-size:13px;line-height:1.55}
.lecture-corrections{border-left:4px solid #bd7a22!important;background:#fffbf2!important}
.lecture-correction{padding:10px 0;border-top:1px solid #f0dcc0}
.lecture-correction:first-of-type{border-top:0}
.lecture-correction strong{display:block;font-size:14px;color:#784a15}
.lecture-correction p{margin:5px 0!important}
.lecture-correction small{display:block;color:#78694c;margin-top:5px}
@media(max-width:680px){
 .verified-schematic{overflow-x:auto;padding:9px}
 .verified-schematic svg{min-width:440px}
 .ripple-schematic svg{min-width:640px}
}


/* Digitally drawn lecture handouts: no photographs, no AI-generated truth-table bitmaps. */
.study-shell{max-width:1200px}
.study-topic-nav{display:grid;grid-template-columns:repeat(auto-fit,minmax(178px,1fr));gap:8px;margin-top:15px}
.study-topic-nav button{text-align:left;display:flex;gap:10px;align-items:center;line-height:1.3;
 padding:12px 14px;border:1px solid #c5d6e9;border-radius:12px;background:#f8fbff;color:#22517e;font-weight:650}
.study-topic-nav button span{display:inline-grid;place-items:center;background:#e5effb;color:#1d568f;
 border-radius:50%;width:29px;height:29px;min-width:29px;font-size:12px}
.study-topic-nav button.chosen{background:#194e8c;color:white;border-color:#194e8c}
.study-topic-nav button.chosen span{background:var(--surface);color:#194e8c}
.study-topic-nav button:focus-visible{outline:3px solid #e6a845;outline-offset:2px}
.study-sheet{--ink:#18487f;--rule:rgba(77,123,183,.18);
 color:var(--ink);max-width:1080px;margin:16px auto 26px;padding:46px 52px 35px;
 background:
  linear-gradient(90deg,transparent 51px,rgba(212,71,78,.4) 52px,transparent 53px),
  repeating-linear-gradient(to bottom,#fff 0,#fff 31px,var(--rule) 32px,var(--rule) 33px);
 background-color:#fff;border:1px solid #c7d5e7;border-radius:10px;
 box-shadow:0 5px 19px rgba(25,69,124,.09);font-size:16px}
.study-sheet-heading{text-align:center;padding:2px 0 24px;border-bottom:2px solid #22578b}
.study-sheet-number{display:inline-block;font-weight:800;letter-spacing:.16em;font-size:12px;text-transform:uppercase}
.study-sheet-heading h2{font-family:Georgia,"Times New Roman",serif;font-size:clamp(24px,3vw,36px);
 margin:10px 0 13px;color:#163f74;line-height:1.25}
.study-sheet-lead{max-width:810px;margin:auto;font-size:17px;line-height:1.65}
.study-paper-section{margin:25px 0 30px}
.study-paper-section h3{font-family:Georgia,"Times New Roman",serif;color:#124477;
 font-size:23px;margin:12px 0 14px;border-bottom:1px solid #8bb0d8;padding-bottom:6px}
.study-paper-section h4{font-size:17px;color:#23568e;margin:13px 0 9px}
.study-paper-section p{line-height:1.7;max-width:900px}
.study-gate-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px;margin-top:20px}
.study-gate-card{background:rgba(255,255,255,.91);border:1px solid #a7bfd9;
 border-radius:10px;display:grid;align-content:start;gap:9px;padding:12px}
.study-gate-card h4{margin:0;text-align:center;font-size:17px;letter-spacing:.04em}
.study-gate-icon{width:100%;height:auto;display:block}
.study-equation{font-family:Georgia,"Times New Roman",serif;font-size:18px;font-weight:700;
 padding:8px 10px;margin:4px 0;background:#e9f2fb;border-radius:7px;overflow-wrap:anywhere}
.study-gate-card .study-equation{font-size:15px;text-align:center;margin:0}
.study-truth-table{border-collapse:collapse;font-size:14px;table-layout:auto;min-width:100%;
 background:var(--surface)}
.study-truth-table th,.study-truth-table td{border:1px solid #7da0c9;padding:7px 9px;
 text-align:center;white-space:nowrap}
.study-truth-table th{background:#e6f0fc;font-weight:800}
.study-truth-table tr:nth-child(even) td{background:#f4f8ff}
.study-truth-table .study-output{font-weight:800;color:#175796}
.study-table-scroll{overflow-x:auto;margin:15px 0 22px;max-width:100%}
.study-formula-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(175px,1fr));
 gap:10px;margin:14px 0}
.study-formula-grid span{font-family:Georgia,"Times New Roman",serif;font-size:18px;
 border:1px solid #b4cce5;padding:12px;background:#f3f8ff;border-radius:7px;text-align:center}
.study-note{padding:13px 16px;border-left:3px solid #255b94;background:#eef5fd;
 border-radius:7px;margin:18px 0}
.study-paper-caution{border:1px solid #d4c195;background:rgba(255,249,232,.95);
 padding:15px 18px;border-radius:9px;margin-top:25px}
.study-paper-caution p{margin:7px 0 0;line-height:1.55}
.study-paper-footer{margin-top:25px;text-align:center;border-top:1px solid #b6cde5;
 padding-top:14px;font-size:12px;letter-spacing:.03em;color:#54749b}
.study-sheet .verified-schematic{background:rgba(248,251,255,.93)}
.study-sheet .verified-schematic svg{max-height:395px}
.study-bottom-nav{margin:18px auto 30px}
@media(max-width:980px){
 .study-gate-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .study-sheet{padding:32px 33px;background:repeating-linear-gradient(to bottom,#fff 0,#fff 31px,var(--rule) 32px,var(--rule) 33px)}
}
@media(max-width:560px){
 .study-gate-grid{grid-template-columns:1fr}
 .study-sheet{padding:22px 12px;margin:12px 0}
 .study-sheet-heading h2{font-size:24px}
 .study-topic-nav{grid-template-columns:1fr}
 .study-truth-table th,.study-truth-table td{padding:6px;font-size:12px}
}
@media print{
 .hero,.study-topic-nav,.study-bottom-nav,.pagination,body>footer{display:none!important}
 .study-sheet{max-width:none;margin:0;box-shadow:none;border:0;break-inside:auto;padding:16mm 11mm}
 .study-gate-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
 .study-gate-card,.study-paper-section{break-inside:avoid}
 .study-sheet .verified-schematic{break-inside:avoid}
}


/* Lecture readability: keep notebook rules behind the content, never through text. */
.study-sheet .study-paper-section{
  background:rgba(255,255,255,.97);
  border:1px solid rgba(168,190,218,.62);
  border-radius:12px;
  padding:17px 20px 22px;
  margin:24px 0 29px;
}
.study-sheet .study-paper-section h3{
  margin:0 0 15px;
  padding:0 0 10px;
  line-height:1.4;
  background:var(--surface);
  text-wrap:balance;
}
.study-sheet .study-paper-section>p{
  margin:10px 0 16px;
  line-height:1.75;
}
.study-definition-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
  margin:17px 0 21px;
}
.study-definition-card{
  margin:0;
  padding:20px 22px;
  border-radius:11px;
  border:1px solid #b5cde6;
  background:#f3f8ff;
}
.study-definition-card dt{
  color:#173f76;
  font-size:18px;
  font-weight:800;
  padding-bottom:10px;
  border-bottom:1px solid #bed3e9;
}
.study-definition-card dd{
  margin:12px 0 0;
  font-size:16px;
  line-height:1.7;
}
.study-definition-card .study-definition-example{
  font-weight:650;
  color:#2a5d92;
  margin-top:14px;
}
.study-sheet-heading{background:var(--surface);border-radius:9px;padding:12px 12px 24px}
.study-sheet .study-note{background:#edf5fe}
@media(max-width:700px){
  .study-definition-grid{grid-template-columns:1fr}
  .study-sheet .study-paper-section{padding:14px 13px;margin:18px 0}
  .study-definition-card{padding:16px}
}
@media print{
  .study-sheet .study-paper-section{
    background:var(--surface);
    break-inside:auto;
  }
  .study-definition-card{break-inside:avoid}
}


/* Expanded, fully typed digital-logic lessons and visible explanations. */
.study-gate-definition{color:#294c75;font-size:13px;line-height:1.5;margin:0;min-height:53px}
.study-action{text-align:left;min-width:210px;max-width:390px;white-space:normal!important;font-size:12px}
.study-display{display:flex;align-items:center;gap:22px;padding:17px;border:1px solid #adcbe8;
  background:rgba(249,252,255,.96);border-radius:12px;margin:17px 0}
.study-display svg{width:118px;min-width:90px;max-height:210px}
.study-display>div{max-width:610px}
.study-display strong{font-size:20px;color:#164e89}
.study-display p{line-height:1.55}
.study-sheet .study-table-scroll table{max-width:100%}
.study-shell .study-topic-nav button{min-height:61px}
.study-sheet .study-definition-grid{align-items:stretch}
@media(max-width:610px){
 .study-display{gap:10px;padding:12px}
 .study-display svg{width:78px;min-width:70px}
 .study-action{min-width:160px}
}


/* Full-curriculum exam: readable, keyboard-friendly answers without correctness hints. */
.syllabus-topic-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(225px,1fr));gap:8px;margin-top:17px}
.syllabus-topic-list>div{display:flex;align-items:center;gap:12px;padding:11px 12px;border-radius:9px;border:1px solid #d2e0ef;background:#f8fbff}
.syllabus-topic-list strong{color:#1f548a;font-variant-numeric:tabular-nums}
.syllabus-topic-list span{line-height:1.4}
.syllabus-question-prompt{font-size:clamp(19px,2.2vw,25px);line-height:1.48;margin:19px 0 22px}
.syllabus-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;margin:14px 0 25px}
.syllabus-option{display:flex;align-items:center;text-align:left;gap:14px;padding:17px 18px;border-radius:12px;min-height:75px;
 border:2px solid #cbd8e8;background:#fafcff;color:#1a385c;cursor:pointer;transition:background .12s,border-color .12s}
.syllabus-option>strong{border-radius:50%;background:#e8f0fb;color:#24588e;display:grid;place-items:center;min-width:30px;height:30px}
.syllabus-option>span:nth-of-type(1){flex:1;overflow-wrap:anywhere}
.syllabus-option:hover:not(:disabled){border-color:#5184b5;background:#eaf4ff}
.syllabus-option.chosen{border-color:#29629b;background:#e5f1ff}
.syllabus-option:focus-visible{outline:3px solid #d39d30;outline-offset:2px}
.syllabus-option:disabled{cursor:default;opacity:1}
.syllabus-option.syllabus-answer-correct{border-color:#35825e;background:#edf8f1}
.syllabus-answer-marker{font-weight:800;color:#236e4b;font-size:13px}
.syllabus-feedback{background:#f5f8fc;border:1px solid #b9ccdf;border-radius:12px;padding:18px 20px;line-height:1.6}
.syllabus-feedback strong{color:#1f588c}
.syllabus-feedback p{margin:8px 0 0}
@media(max-width:700px){.syllabus-options{grid-template-columns:1fr}.syllabus-topic-list{grid-template-columns:1fr}}
@media print{.syllabus-options button{break-inside:avoid}.syllabus-topic-list{display:none}}


/* Truth-table-first exam: compact editable bits, wide tables scroll horizontally. */
.exam-table-scroll{overflow-x:auto;max-width:100%;margin:20px 0;border-radius:10px;
  border:1px solid #c9d9ec;background:var(--surface)}
.exam-table-scroll table{border-collapse:collapse;width:max-content;min-width:100%}
.exam-table-scroll thead th{position:sticky;top:0;background:#e7f0fb;z-index:1;
  border:1px solid #afc7e2;padding:11px 14px;white-space:nowrap;color:#1d5087}
.exam-table-scroll tbody td{border:1px solid #c3d3e6;padding:8px 12px;
  text-align:center;white-space:nowrap}
.exam-table-scroll tbody tr:nth-child(even){background:#f6f9fe}
.exam-table-scroll .answer-cell{min-width:121px;white-space:normal}
.exam-table-scroll .choice{display:flex;align-items:center;justify-content:center;
  flex-wrap:nowrap;gap:4px}
.exam-table-scroll .choice button{font-variant-numeric:tabular-nums;
  padding:6px 9px;min-width:30px;min-height:34px;font-weight:750}
.exam-table-scroll .choice button:focus-visible{outline:3px solid #d4a34c;outline-offset:2px}
.exam-table-scroll .answer-cell small{display:block;margin-top:5px;font-weight:700}
.exam-schematic{margin:16px 0;padding:12px;background:#f8fbff;
  border:1px solid #c6d8ed;border-radius:12px;overflow-x:auto}
.exam-schematic svg{width:100%;height:auto;max-height:370px;display:block}
.exam-schematic figcaption{font-size:13px;line-height:1.5;margin-top:9px;color:#4e6279}
.exam-schematic.exam-symbol{max-width:400px}
.exam-schematic .verified-schematic{border:0;margin:8px 0}
.exam-schematic .verified-schematic svg{max-height:410px}
.exam-table-scroll .answer-cell.correct{background:#e9f7ee}
.exam-table-scroll .answer-cell.incorrect{background:#fff1eb}
@media(max-width:610px){
  .exam-table-scroll tbody td{padding:6px 8px}
  .exam-table-scroll .answer-cell{min-width:110px}
  .exam-schematic svg{min-width:430px}
  .exam-schematic.exam-symbol svg{min-width:0}
}


/* Recent-variant preferences are optional and stored only in this browser. */
.exam-variation-settings{display:flex;align-items:center;gap:13px;flex-wrap:wrap;
  padding:15px 18px;margin:18px 0 6px;border:1px solid #c9d9e9;border-radius:12px;background:#f7faff}
.exam-variation-settings label{display:flex;align-items:center;gap:8px;font-weight:650;
  color:#204b76;cursor:pointer;min-height:38px}
.exam-variation-settings input[type="checkbox"]{width:18px;height:18px;accent-color:#265d96}
.exam-variation-settings button{padding:8px 13px;font-size:13px}
.exam-variation-settings p{flex-basis:100%;margin:0;line-height:1.55}
@media(max-width:650px){.exam-variation-settings{align-items:stretch;flex-direction:column}}


/* Topic-level exam analytics. Use existing page typography and neutral containers. */
.progress-empty{border:1px dashed #b8cce1;border-radius:12px;padding:20px;margin:15px 0;background:#f8fbff}
.progress-empty h3{margin:0 0 7px}
.progress-empty p{line-height:1.65}
.progress-recommendations{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:13px;margin:16px 0}
.progress-recommendation{background:#f7faff;border:1px solid #c2d8ed;border-radius:12px;padding:17px 19px}
.progress-recommendation strong{display:block;color:#1b4f84;line-height:1.45}
.progress-recommendation p{margin:12px 0;line-height:1.55}
.progress-recommendation a,.progress-topic-heading a{color:#245c96;font-weight:700;text-decoration:underline;text-underline-offset:3px}
.progress-topic-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:17px 0}
.progress-topic-row{min-width:0;border:1px solid #cedbe9;border-radius:11px;padding:17px;background:var(--surface)}
.progress-topic-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.progress-topic-heading strong{color:#1e4e80;line-height:1.4}
.progress-topic-heading a{white-space:nowrap;font-size:13px}
.progress-topic-metrics{display:flex;gap:6px 14px;flex-wrap:wrap;margin:13px 0 9px;font-size:13px}
.progress-topic-metrics span:first-child{font-weight:800;color:#285d94}
.progress-topic-track{height:11px;border-radius:12px;background:#e8eff7;overflow:hidden;margin-bottom:9px}
.progress-topic-fill{height:100%;background:#4a80ba;border-radius:12px;transition:width .2s}
.progress-topic-row small{color:#546b85}
.progress-topic-metrics .trend-up{color:#28654d;font-weight:700}
.progress-topic-metrics .trend-down{color:#a13e2e;font-weight:700}
.progress-attempts{display:grid;gap:7px;margin-top:16px}
.progress-attempts>div{display:grid;grid-template-columns:1fr auto 1.3fr;align-items:center;gap:14px;
  border-bottom:1px solid #dee6f1;padding:11px 4px}
.progress-attempts span{color:#51657e;font-size:13px}
.progress-attempts strong{text-align:center}
@media(max-width:900px){
  .progress-topic-list{grid-template-columns:1fr}
  .progress-recommendations{grid-template-columns:1fr}
}
@media(max-width:560px){
  .progress-attempts>div{grid-template-columns:1fr auto}
  .progress-attempts>div span:last-child{grid-column:1/-1}
  .progress-topic-heading{flex-wrap:wrap}
}
@media print{
  .progress-topic-row,.progress-recommendation{break-inside:avoid}
  .progress-topic-list{grid-template-columns:repeat(2,minmax(0,1fr))}
}


/* Adaptive syllabus reuses the verified exam surface; only the focus panel is new. */
.adaptive-syllabus-focus{border-left:4px solid #6f90ae}
.adaptive-syllabus-focus h2{margin-top:0}
.adaptive-syllabus-focus p{line-height:1.65}
.adaptive-syllabus-focus strong{color:#244e79}
@media print{.adaptive-syllabus-focus{break-inside:avoid}}


/* Circuit-driven exam-like practice; SVG is vector and does not expose solved labels. */
.schematic-drill-symbol{max-width:420px;margin:18px auto 24px;padding:16px;
  border:1px solid #cfdeed;border-radius:13px;background:#f8fbff}
.schematic-drill-symbol svg{display:block;width:100%;height:auto;max-height:230px}
.schematic-drill-circuit{margin:16px 0;padding:12px;border:1px solid #c8d9eb;
  border-radius:13px;background:#fbfdff;overflow-x:auto}
.schematic-drill-circuit .circuit{max-height:530px}
.schematic-drill-circuit .gate-body{fill:#fbfdff}
.schematic-drill-circuit .wire-label{font-weight:800}
@media(max-width:630px){
 .schematic-drill-symbol{max-width:330px}
 .schematic-drill-circuit{padding:8px}
 .schematic-drill-circuit .circuit{min-width:670px}
}
@media print{
 .schematic-drill-symbol,.schematic-drill-circuit{break-inside:avoid}
 .schematic-drill-circuit .circuit{min-width:0;max-height:none}
}


/* Notebook-aligned digital logic examples, redrawn without exposing source photos. */
.lecture-example-nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:18px 0}
.lecture-example-nav button{text-align:left;min-height:46px;line-height:1.4}
.lecture-example-nav button.chosen{background:var(--primary);border-color:var(--primary);color:#fff}
.lecture-topology{margin:20px 0;padding:12px;border:1px solid #cbdbea;
  border-radius:12px;background:#f8fbff;overflow:auto}
.lecture-topology svg{display:block;width:100%;min-width:480px;max-height:520px}
.lecture-topology figcaption{font-size:14px;line-height:1.6;color:#3e5875;margin:12px 4px 2px}
.lecture-topology figcaption strong{color:#90422a}
@media(max-width:650px){.lecture-example-nav{grid-template-columns:1fr}
  .lecture-topology{padding:8px}.lecture-topology svg{min-width:670px}}
@media print{.lecture-topology{break-inside:avoid}.lecture-topology svg{min-width:0}}


/* Eighteen-question strict mock exam — no backward navigation while running. */
.mock-review-nav{display:flex;gap:7px;flex-wrap:wrap;margin:17px 0 22px}
.mock-review-nav button{min-width:39px;min-height:39px;font-weight:750;font-variant-numeric:tabular-nums}
.mock-review-nav button.chosen{background:var(--primary);color:#fff;border-color:var(--primary)}
.mock-result{display:flex;gap:9px 18px;flex-wrap:wrap;align-items:center;
  border:1px solid #c6d6e7;border-radius:12px;background:#f5f9fe;
  margin:16px 0;padding:19px 22px;color:#254d78}
.mock-result .mock-grade{display:block;flex-basis:100%;font-size:27px;line-height:1.35}
.mock-result span{font-size:14px;line-height:1.5}
@media(max-width:610px){.mock-review-nav button{min-width:34px;min-height:36px}
  .mock-result{padding:14px}.mock-result .mock-grade{font-size:23px}}
@media print{.mock-review-nav{display:none}.mock-result{break-inside:avoid}}

/* Stage 2: schematics */
.circuit-frame{position:relative}
.scroll-hint{display:none;margin:6px 0 0;font-size:13px;color:var(--muted);text-align:center}
@media(max-width:700px){.scroll-hint{display:block}}
.logic-block .block-body{fill:#f3f7fd;stroke:var(--ink-diagram)}
.logic-block .block-title{fill:var(--ink-diagram)}
.logic-block .block-subtitle{fill:#426b98}
.logic-block .bubble{fill:#fff}
.signal line{stroke:var(--sig-low)}
.signal text{fill:var(--sig-low)}
.signal .bubble{stroke:var(--sig-low)}
.signal.high line{stroke:var(--sig-high);stroke-width:5}
.signal.high text{fill:var(--sig-high)}
.signal.high .bubble{stroke:var(--sig-high)}
.signal.undefined line{stroke:var(--sig-undef);stroke-dasharray:6 5}
.signal.undefined text{fill:var(--sig-undef)}
.signal-legend{display:inline-flex;align-items:center;gap:6px;margin-right:12px;font-weight:650;color:var(--text)}
.sig-swatch{display:inline-block;width:22px;height:0;border-top:4px solid var(--sig-low);border-radius:2px}
.sig-swatch.high{border-top:5px solid var(--sig-high)}
.sig-swatch.undefined{border-top:3px dashed var(--sig-undef)}
.input-switches{display:flex;flex-wrap:wrap;gap:8px;margin:4px 0 6px}
.input-switch{display:inline-flex;align-items:center;gap:10px;padding:8px 12px;min-height:44px;border-radius:10px;border:1px solid var(--border-strong);background:var(--surface);font-weight:650}
.input-switch strong{display:inline-grid;place-items:center;min-width:28px;height:28px;border-radius:7px;background:#e8eef6;color:var(--sig-low);font-variant-numeric:tabular-nums}
.input-switch.on{border-color:var(--sig-high);background:#edf8f1}
.input-switch.on strong{background:var(--sig-high);color:#fff}
.input-switch:hover:not(:disabled){border-color:var(--primary)}

/* Stage 3: exam experience */
.exam-dock{position:sticky;top:calc(var(--appbar-h) + 8px);z-index:30;display:flex;align-items:center;flex-wrap:wrap;gap:10px 16px;margin:0 0 14px;padding:10px 14px;background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:0 10px 26px #12305a1f}
.exam-dock-clock{font-variant-numeric:tabular-nums;font-size:22px;color:var(--accent-strong);letter-spacing:.5px}
.exam-dock-clock.exam-clock-warning{color:var(--danger)}
.exam-dock-progress{font-weight:650;color:var(--muted);font-size:14px}
.exam-dock-bar{flex:1 1 120px;height:6px;background:#e5eaf3;border-radius:20px;overflow:hidden;min-width:80px}
.exam-dock-bar div{height:100%;background:var(--primary);transition:width .2s}
.exam-dock button{margin-left:auto}
@media(max-width:560px){.exam-dock{padding:8px 10px;gap:6px 10px}.exam-dock-clock{font-size:19px}.exam-dock-bar{order:5;flex-basis:100%}}
.exam-question-nav button.complete:not(.chosen),.mock-review-nav button.complete:not(.chosen){background:var(--success-bg);border-color:#9fd3b8;color:var(--success)}
.exam-question-nav button.partial:not(.chosen){background:#fff7e6;border-color:#e6c27a;color:#7a5410}
.table-keys-hint{margin:8px 0 6px;font-size:13px;color:var(--muted)}
.table-keys-hint kbd{display:inline-block;min-width:20px;padding:1px 6px;border:1px solid var(--border-strong);border-bottom-width:2px;border-radius:5px;background:var(--surface);font:600 12px/1.4 ui-monospace,Consolas,monospace;color:var(--text);text-align:center}
.table-keys-hint .keys-touch{display:none}
@media(hover:none),(max-width:700px){.table-keys-hint .keys-desktop{display:none}.table-keys-hint .keys-touch{display:inline}}
.choice button:focus-visible{outline:3px solid var(--focus);outline-offset:1px;position:relative;z-index:2}
@media(max-width:640px){.exam-table-scroll th,.exam-table-scroll td{padding:6px 3px}.exam-table-scroll .choice{gap:2px}.exam-table-scroll .choice button{min-width:30px;min-height:36px;padding:4px 6px}}

/* Stage 4: exams hub */
.study-path{list-style:none;counter-reset:step;margin:6px 0 0;padding:0;display:grid;gap:8px}
.study-path li{counter-increment:step;display:grid;grid-template-columns:34px 1fr;column-gap:12px;align-items:start;padding:10px 12px;border:1px solid var(--border);border-radius:12px;background:var(--surface-2)}
.study-path li::before{content:counter(step);grid-row:span 2;display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--primary);color:#fff;font-weight:800}
.study-path a{color:var(--accent-strong);text-decoration:none}
.study-path a:hover{text-decoration:underline}
.study-path span{color:var(--muted);font-size:14px}
.mode-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px;margin-bottom:18px}
.mode-grid .panel{margin-bottom:0}
.mode-card{display:flex;flex-direction:column;gap:10px}
.mode-card p{margin:0;color:var(--muted)}
.mode-card-head{display:flex;flex-direction:column;align-items:flex-start;gap:8px}
.mode-card h2{font-size:19px}
.mode-kind{font-size:12px;font-weight:800;letter-spacing:.4px;text-transform:uppercase;padding:3px 9px;border-radius:999px}
.mode-kind.practice{background:var(--success-bg);color:var(--success)}
.mode-kind.exam{background:var(--surface-3);color:var(--accent)}
.mode-kind.mock{background:#fff1e0;color:#8a4b0f}
.mode-facts{margin:0;display:grid;grid-template-columns:1fr 1fr;gap:8px}
.mode-facts div{background:var(--surface-2);border-radius:9px;padding:8px 10px}
.mode-facts dt{font-size:12px;color:var(--muted);font-weight:700}
.mode-facts dd{margin:2px 0 0;font-weight:650;font-size:14px}
.primary-link{margin-top:auto;align-self:flex-start;background:var(--primary);color:#fff;text-decoration:none;font-weight:700;padding:10px 15px;border-radius:var(--radius-sm)}
.primary-link:hover{background:var(--primary-hover)}
.primary-link:focus-visible{outline:3px solid var(--focus);outline-offset:2px}
@media(max-width:420px){.mode-facts{grid-template-columns:1fr}}
