:root {
  --c-bg:      #f8f9fb;
  --c-white:   #ffffff;
  --c-blue:    #0a1f44;
  --c-blue2:   #1a3a6e;
  --c-blue3:   #2952a3;
  --c-red:     #c8102e;
  --c-red2:    #e01530;
  --c-teal:    #0e8a7a;
  --c-amber:   #d97706;
  --c-border:  #dde2ec;
  --c-border2: #c4ccd8;
  --c-text:    #1c2b45;
  --c-text2:   #4d617a;
  --c-text3:   #8a9bb5;
  --c-bg2:     #eef1f7;
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Inter', sans-serif;
  --r:         10px;
  --sh:        0 2px 12px rgba(10,31,68,.07);
  --sh2:       0 8px 32px rgba(10,31,68,.13);
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body { font-family: var(--sans); background: var(--c-bg); color: var(--c-text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
::selection { background: rgba(200,16,46,.15); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--c-bg2); }
::-webkit-scrollbar-thumb { background: var(--c-border2); border-radius: 3px; }
.hidden { display: none !important; }

/* ---------- top nav ---------- */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(248,249,251,.95); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  height: 60px; display: flex; align-items: center;
}
.nav-in { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-weight: 800; font-size: 1rem; color: var(--c-blue); }
.logo em { color: var(--c-red); font-style: normal; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { font-size: .84rem; font-weight: 500; color: var(--c-text2); transition: color .2s; }
.nav-links a:hover { color: var(--c-red); }
.nav-links a.active { color: var(--c-red); }

/* ---------- catalog page ---------- */
.catalog-wrap { max-width: 1080px; margin: 0 auto; padding: 96px 24px 80px; }
.cat-head { margin-bottom: 40px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(200,16,46,.08); border: 1px solid rgba(200,16,46,.22);
  color: var(--c-red); font-family: var(--mono); font-size: .67rem; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase; padding: 6px 14px; border-radius: 20px; margin-bottom: 18px;
}
.cat-chip i { width: 6px; height: 6px; background: var(--c-red); border-radius: 50%; }
.cat-h1 { font-size: clamp(1.9rem, 3.5vw, 2.7rem); font-weight: 800; letter-spacing: -.6px; color: var(--c-blue); margin-bottom: 14px; line-height: 1.12; }
.cat-sub { font-size: 1.02rem; color: var(--c-text2); max-width: 620px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.cat-card {
  background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--r);
  padding: 24px; box-shadow: var(--sh); transition: all .25s; display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--sh2); border-color: var(--c-border2); }
.cat-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cat-card-ico { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 1.4rem; background: var(--c-bg2); flex-shrink: 0; }
.cat-card-lvl { font-family: var(--mono); font-size: .6rem; letter-spacing: 1px; text-transform: uppercase; color: var(--c-text3); font-weight: 600; }
.cat-card-h { font-size: 1.18rem; font-weight: 700; color: var(--c-blue); margin-bottom: 8px; line-height: 1.25; }
.cat-card-p { font-size: .9rem; color: var(--c-text2); margin-bottom: 18px; flex: 1; }
.cat-card-meta { display: flex; gap: 14px; font-family: var(--mono); font-size: .66rem; color: var(--c-text3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 16px; }
.cat-card-meta b { color: var(--c-text2); }
.cat-card-prog { height: 6px; background: var(--c-bg2); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.cat-card-prog i { display: block; height: 100%; background: var(--c-teal); border-radius: 3px; transition: width .4s; }
.cat-card-prog-txt { font-family: var(--mono); font-size: .64rem; color: var(--c-text3); margin-bottom: 16px; }
.cat-card-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--c-red); color: #fff; font-weight: 700; font-size: .85rem;
  padding: 11px 0; border-radius: 8px; transition: all .2s; box-shadow: 0 4px 14px rgba(200,16,46,.28);
}
.cat-card-btn:hover { background: var(--c-red2); }
.cat-card.soon { opacity: .72; }
.cat-card.soon .cat-card-btn { background: var(--c-bg2); color: var(--c-text3); box-shadow: none; cursor: default; pointer-events: none; }
.cat-badge { position: absolute; top: 16px; right: -28px; transform: rotate(45deg); background: var(--c-amber); color:#fff; font-family: var(--mono); font-size: .56rem; font-weight: 700; letter-spacing: 1px; padding: 3px 36px; text-transform: uppercase; }

/* ---------- course player layout ---------- */
.course {
  display: grid; grid-template-columns: 320px 1fr;
  max-width: 1280px; margin: 60px auto 0; min-height: calc(100vh - 60px);
}
.sidebar {
  border-right: 1px solid var(--c-border); background: var(--c-white);
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 22px 18px 40px;
}
.sb-title { font-size: 1.05rem; font-weight: 800; color: var(--c-blue); line-height: 1.25; margin-bottom: 4px; }
.sb-sub { font-family: var(--mono); font-size: .64rem; color: var(--c-text3); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 16px; }
.sb-prog-bar { height: 8px; background: var(--c-bg2); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.sb-prog-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--c-teal), var(--c-blue3)); border-radius: 4px; transition: width .4s; }
.sb-prog-txt { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .64rem; color: var(--c-text3); margin-bottom: 18px; }
.sb-prog-txt b { color: var(--c-teal); }
.sb-reset {
  width: 100%; background: none; border: 1px solid var(--c-border2); color: var(--c-text2);
  font-family: var(--sans); font-size: .76rem; font-weight: 600; padding: 8px; border-radius: 7px;
  cursor: pointer; transition: all .2s; margin-bottom: 22px;
}
.sb-reset:hover { border-color: var(--c-red); color: var(--c-red); background: rgba(200,16,46,.04); }

.sb-mod { margin-bottom: 6px; }
.sb-mod-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 8px; cursor: pointer; border-radius: 7px;
  font-size: .76rem; font-weight: 700; color: var(--c-blue); transition: background .15s; user-select: none;
}
.sb-mod-head:hover { background: var(--c-bg2); }
.sb-mod-num { font-family: var(--mono); font-size: .62rem; color: var(--c-text3); font-weight: 600; }
.sb-mod-tt { flex: 1; line-height: 1.25; }
.sb-mod-chev { font-size: .7rem; color: var(--c-text3); transition: transform .2s; }
.sb-mod.collapsed .sb-mod-chev { transform: rotate(-90deg); }
.sb-mod.collapsed .sb-lessons { display: none; }
.sb-mod-done { width: 16px; height: 16px; border-radius: 50%; background: var(--c-teal); color:#fff; font-size:.6rem; display:none; place-items:center; flex-shrink:0; }
.sb-mod.alldone .sb-mod-done { display: grid; }

.sb-lessons { padding: 2px 0 6px 4px; }
.sb-lesson {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; cursor: pointer;
  font-size: .8rem; color: var(--c-text2); transition: all .15s; line-height: 1.3;
}
.sb-lesson:hover { background: var(--c-bg2); color: var(--c-text); }
.sb-lesson.active { background: rgba(41,82,163,.09); color: var(--c-blue); font-weight: 600; }
.sb-lesson-mark {
  width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--c-border2); flex-shrink: 0;
  display: grid; place-items: center; font-size: .62rem; color: transparent; transition: all .2s;
}
.sb-lesson.done .sb-lesson-mark { background: var(--c-teal); border-color: var(--c-teal); color: #fff; }
.sb-lesson-id { font-family: var(--mono); font-size: .66rem; color: var(--c-text3); flex-shrink: 0; }

/* ---------- main content ---------- */
.content { padding: 36px 48px 100px; max-width: 860px; }
.lc-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 6px; flex-wrap: wrap; }
.lc-mod-tag { font-family: var(--mono); font-size: .64rem; letter-spacing: 1px; text-transform: uppercase; color: var(--c-red); font-weight: 600; }
.lc-pos { font-family: var(--mono); font-size: .66rem; color: var(--c-text3); }
.lc-h1 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 800; color: var(--c-blue); letter-spacing: -.4px; line-height: 1.18; margin-bottom: 26px; }

.blk { margin-bottom: 18px; }
.blk-h { font-size: 1.12rem; font-weight: 700; color: var(--c-blue2); margin: 28px 0 12px; padding-bottom: 7px; border-bottom: 1px solid var(--c-border); }
.blk-p { font-size: .98rem; color: var(--c-text); line-height: 1.72; }
.blk-p b { color: var(--c-blue); }
.blk-list { display: flex; flex-direction: column; gap: 8px; padding-left: 2px; }
.blk-list li { display: flex; gap: 10px; font-size: .96rem; color: var(--c-text); line-height: 1.6; }
.blk-list li::before { content: '▸'; color: var(--c-red); font-size: .85rem; flex-shrink: 0; margin-top: 1px; }
.blk-pre {
  font-family: var(--mono); font-size: .8rem; line-height: 1.55; color: var(--c-text);
  background: var(--c-white); border: 1px solid var(--c-border); border-left: 3px solid var(--c-blue3);
  border-radius: 8px; padding: 16px 18px; overflow-x: auto; white-space: pre; box-shadow: var(--sh);
}
.blk-note {
  background: rgba(14,138,122,.07); border: 1px solid rgba(14,138,122,.22); border-left: 3px solid var(--c-teal);
  border-radius: 8px; padding: 14px 18px; font-size: .94rem; color: var(--c-text); line-height: 1.66;
}
.blk-note.warn { background: rgba(217,119,6,.07); border-color: rgba(217,119,6,.25); border-left-color: var(--c-amber); }
.blk-note.danger { background: rgba(200,16,46,.06); border-color: rgba(200,16,46,.22); border-left-color: var(--c-red); }
.blk-note b { color: var(--c-blue); }
.blk-note .blk-note-lbl { display:block; font-family: var(--mono); font-size:.62rem; letter-spacing:1px; text-transform:uppercase; font-weight:700; margin-bottom:5px; color: var(--c-teal); }
.blk-note.warn .blk-note-lbl { color: var(--c-amber); }
.blk-note.danger .blk-note-lbl { color: var(--c-red); }

/* ---------- inline quiz ---------- */
.quiz-box { background: var(--c-white); border: 1px solid var(--c-border); border-radius: var(--r); padding: 24px; margin-top: 36px; box-shadow: var(--sh); }
.quiz-box-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.quiz-box-ico { width: 30px; height: 30px; border-radius: 8px; background: rgba(200,16,46,.1); color: var(--c-red); display: grid; place-items: center; font-size: .9rem; }
.quiz-box-title { font-size: 1.05rem; font-weight: 700; color: var(--c-blue); }
.quiz-box-sub { font-size: .85rem; color: var(--c-text2); margin-bottom: 20px; }
.qq { margin-bottom: 22px; }
.qq-q { font-size: .96rem; font-weight: 600; color: var(--c-text); margin-bottom: 12px; line-height: 1.5; }
.qq-q span { color: var(--c-text3); font-family: var(--mono); font-size: .8rem; margin-right: 6px; }
.qq-opts { display: flex; flex-direction: column; gap: 8px; }
.qq-opt {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px; border: 1.5px solid var(--c-border);
  border-radius: 9px; cursor: pointer; transition: all .15s; font-size: .92rem; color: var(--c-text);
}
.qq-opt:hover { border-color: var(--c-border2); background: var(--c-bg2); }
.qq-opt.sel { border-color: var(--c-blue3); background: rgba(41,82,163,.06); }
.qq-opt-mark { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--c-border2); flex-shrink: 0; position: relative; transition: all .15s; }
.qq-opt.sel .qq-opt-mark { border-color: var(--c-blue3); }
.qq-opt.sel .qq-opt-mark::after { content:''; position:absolute; inset:3px; border-radius:50%; background: var(--c-blue3); }
/* checked states */
.qq.checked .qq-opt { cursor: default; pointer-events: none; }
.qq.checked .qq-opt.correct { border-color: var(--c-teal); background: rgba(14,138,122,.08); }
.qq.checked .qq-opt.wrong { border-color: var(--c-red); background: rgba(200,16,46,.06); }
.qq.checked .qq-opt.correct .qq-opt-mark { border-color: var(--c-teal); background: var(--c-teal); }
.qq.checked .qq-opt.correct .qq-opt-mark::after { content:'✓'; position:static; inset:auto; background:none; color:#fff; font-size:.66rem; display:grid; place-items:center; width:100%; height:100%; }
.qq.checked .qq-opt.wrong .qq-opt-mark { border-color: var(--c-red); background: var(--c-red); }
.qq.checked .qq-opt.wrong .qq-opt-mark::after { content:'✕'; position:static; inset:auto; background:none; color:#fff; font-size:.62rem; display:grid; place-items:center; width:100%; height:100%; }
.qq-expl {
  display: none; margin-top: 10px; padding: 11px 14px; border-radius: 8px;
  background: var(--c-bg2); border-left: 3px solid var(--c-blue3); font-size: .88rem; color: var(--c-text2); line-height: 1.6;
}
.qq.checked .qq-expl { display: block; }
.qq-expl b { color: var(--c-blue); }
.qq-expl.ok { background: rgba(14,138,122,.07); border-left-color: var(--c-teal); }
.qq-expl.no { background: rgba(200,16,46,.05); border-left-color: var(--c-red); }

.quiz-actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.quiz-score { font-family: var(--mono); font-size: .82rem; font-weight: 600; color: var(--c-text2); }
.quiz-score b { color: var(--c-teal); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-weight: 700; font-size: .86rem; padding: 11px 24px;
  border-radius: 8px; border: none; cursor: pointer; transition: all .2s;
}
.btn-red { background: var(--c-red); color: #fff; box-shadow: 0 4px 14px rgba(200,16,46,.28); }
.btn-red:hover { background: var(--c-red2); transform: translateY(-1px); }
.btn-red:disabled { background: var(--c-border2); box-shadow: none; cursor: not-allowed; transform: none; }
.btn-line { background: none; color: var(--c-blue); border: 1.5px solid var(--c-border2); }
.btn-line:hover { border-color: var(--c-blue2); }

/* ---------- lesson footer nav ---------- */
.lc-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 40px; padding-top: 26px; border-top: 1px solid var(--c-border); flex-wrap: wrap; }
.lc-nav-btn { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; font-weight: 600; color: var(--c-text2); padding: 10px 18px; border: 1.5px solid var(--c-border); border-radius: 8px; transition: all .2s; cursor: pointer; background: var(--c-white); }
.lc-nav-btn:hover:not(.disabled) { border-color: var(--c-blue2); color: var(--c-blue); }
.lc-nav-btn.disabled { opacity: .4; cursor: not-allowed; }
.lc-nav-btn span { font-family: var(--mono); font-size: .66rem; color: var(--c-text3); display: block; }

.lc-done-toggle { display: inline-flex; align-items: center; gap: 9px; font-size: .86rem; font-weight: 600; color: var(--c-text2); cursor: pointer; user-select: none; }
.lc-done-toggle .box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--c-border2); display: grid; place-items: center; color: transparent; font-size: .8rem; transition: all .2s; }
.lc-done-toggle.on .box { background: var(--c-teal); border-color: var(--c-teal); color: #fff; }
.lc-done-toggle.on { color: var(--c-teal); }

/* ---------- mobile ---------- */
.sb-toggle { display: none; }
.course-complete { text-align: center; padding: 40px 24px; background: linear-gradient(135deg, rgba(14,138,122,.08), rgba(41,82,163,.06)); border: 1px solid rgba(14,138,122,.25); border-radius: var(--r); margin-top: 30px; }
.course-complete h3 { font-size: 1.3rem; color: var(--c-blue); margin-bottom: 8px; }
.course-complete p { color: var(--c-text2); font-size: .95rem; }
.course-complete .big { font-size: 2.4rem; margin-bottom: 8px; }

@media (max-width: 980px) {
  .course { grid-template-columns: 1fr; margin-top: 60px; }
  .sidebar {
    position: fixed; top: 60px; left: 0; bottom: 0; width: 300px; z-index: 90;
    transform: translateX(-100%); transition: transform .25s; box-shadow: var(--sh2);
  }
  .sidebar.open { transform: translateX(0); }
  .sb-backdrop { position: fixed; inset: 60px 0 0 0; background: rgba(10,31,68,.4); z-index: 80; display: none; }
  .sb-backdrop.show { display: block; }
  .content { padding: 28px 22px 90px; }
  .sb-toggle {
    display: inline-flex; align-items: center; gap: 8px; position: fixed; bottom: 20px; left: 20px; z-index: 95;
    background: var(--c-blue); color: #fff; border: none; padding: 12px 18px; border-radius: 30px;
    font-family: var(--sans); font-weight: 600; font-size: .82rem; cursor: pointer; box-shadow: var(--sh2);
  }
  .nav-links { gap: 16px; }
  .cat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .content { padding: 24px 16px 90px; }
  .blk-pre { font-size: .72rem; }
  .lc-foot { flex-direction: column-reverse; align-items: stretch; }
  .lc-nav-btn { justify-content: center; }
}
