/* =========================================================================
   Kurs INF.02 – lekcje i poradniki. Motyw „serwerownia”: jasny „papier
   techniczny” z siatką (albo grafit w trybie ciemnym), diody postępu,
   nagłówki czcionką techniczną, kod jak w konsoli.
   ========================================================================= */
:root {
  --bg: #eef3f1;
  --panel: #ffffff;
  --panel2: #f6faf8;
  --text: #13201c;
  --muted: #5b6f6a;
  --line: #d5e1dc;
  --brand: #0c9a5b;
  --brand-2: #0a8bb0;
  --led: #22c46f;
  --grad: linear-gradient(90deg, #0c9a5b, #0a8bb0);
  --code-bg: #071012;
  --inline-code: #e3eeea;
  --inline-fg: #0b6b45;
  --grid: rgba(19, 32, 28, .05);
  --tip: #0c9a5b; --uwaga: #c77a00; --egzamin: #0a8bb0; --info: #3d6fd8; --zadanie: #c2410c;
  --radius: 10px;
  --sidebar: 304px;
  --mono: 'JetBrains Mono', Consolas, monospace;
  --bar: #0a1114;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090f12; --panel: #0f191d; --panel2: #0c1518; --text: #dfeae6; --muted: #8aa19c; --line: #1f3036;
    --brand: #39e58c; --brand-2: #38c8f0; --led: #39e58c; --grad: linear-gradient(90deg, #39e58c, #38c8f0);
    --inline-code: #13252b; --inline-fg: #8ff0bd; --code-bg: #050a0c; --grid: rgba(148, 214, 196, .045);
    --tip: #39e58c; --uwaga: #ffb627; --egzamin: #38c8f0; --info: #7aa2ff; --zadanie: #ff8a5c;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--text); font: 16.5px/1.72 Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px; background-attachment: fixed;
}
a { color: var(--brand); }
code, pre { font-family: var(--mono); font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
::selection { background: var(--led); color: #04150c; }

/* ---------- górny pasek (zawsze ciemny – jak panel urządzenia) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 18px; background: var(--bar); color: #e2eeea;
  border-bottom: 1px solid rgba(57, 229, 140, .25); box-shadow: 0 1px 0 rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.12);
}
.brand { color: #e2eeea; text-decoration: none; display: flex; align-items: center; gap: 9px; font: 800 18px/1 var(--mono); letter-spacing: -.03em; }
.brand-badge { color: #e2eeea; }
.brand-badge b, .brand b { color: #39e58c; }
.brand-port { position: relative; width: 26px; height: 23px; border: 2px solid #39e58c; border-radius: 3px 3px 6px 6px; display: flex; gap: 2px; justify-content: center; padding-top: 4px; box-shadow: 0 0 10px rgba(57,229,140,.35); flex-shrink: 0; }
.brand-port::after { content: ''; position: absolute; bottom: -2px; left: 50%; width: 9px; height: 5px; transform: translateX(-50%); background: var(--bar); border: 2px solid #39e58c; border-bottom: 0; border-radius: 2px 2px 0 0; }
.brand-port i { width: 2px; height: 7px; background: #ffb627; }
.menu-btn { display: none; background: none; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; color: #e2eeea; font-size: 20px; cursor: pointer; width: 38px; height: 34px; }
.progress { margin-left: auto; display: flex; align-items: center; gap: 10px; font: 600 12.5px var(--mono); color: #8aa19c; }
.progress-bar { width: 170px; height: 10px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; position: relative; }
.progress-bar::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 8px, var(--bar) 8px 10px); pointer-events: none; }
.progress-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #38c8f0, #39e58c); box-shadow: 0 0 10px rgba(57,229,140,.6); transition: width .6s; }
.progress b { color: #39e58c; min-width: 36px; }
.btn-ghost { text-decoration: none; white-space: nowrap; background: transparent; color: #e2eeea; border: 1px solid rgba(255,255,255,.2); padding: 7px 13px; border-radius: 6px; cursor: pointer; font: 600 13.5px var(--mono); }
.btn-ghost:hover { border-color: #38c8f0; color: #38c8f0; }
.btn-buy { background: #39e58c; color: #04150c; text-decoration: none; font: 700 13.5px var(--mono); padding: 8px 14px; border-radius: 6px; white-space: nowrap; box-shadow: 0 0 0 1px rgba(57,229,140,.5), 0 6px 18px rgba(57,229,140,.25); transition: background .2s, transform .15s; }
.btn-buy:hover { background: #5cf3a3; transform: translateY(-1px); }
.btn-buy.big { display: inline-block; padding: 14px 28px; font-size: 16px; margin: 8px 0; }

/* ---------- układ ---------- */
.layout { display: flex; }
.sidebar {
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; width: var(--sidebar); flex-shrink: 0;
  padding: 16px 12px 40px; background: var(--panel2); border-right: 1px solid var(--line);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.mod { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); overflow: hidden; }
.mod-title { display: flex; align-items: center; gap: 8px; font: 700 11.5px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 9px 12px; background: var(--panel2); border-bottom: 1px solid var(--line); }
.sidebar a { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 12px; color: var(--text); text-decoration: none; font-size: 13.8px; line-height: 1.35; border-left: 3px solid transparent; transition: background .15s, border-color .15s; }
.sidebar a:hover { background: var(--inline-code); }
.sidebar a.active { background: var(--inline-code); border-left-color: var(--brand-2); font-weight: 600; }
.sidebar a.active .dot { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(10, 139, 176, .18); animation: led 1.2s steps(2) infinite; }
@keyframes led { 50% { background: var(--brand-2); } }
.sidebar a.locked span { opacity: .55; }
.sidebar a em { margin-left: auto; font-style: normal; font-size: 11px; }
.sidebar a em.free { background: #ffb627; color: #1a1200; padding: 0 5px; border-radius: 3px; font: 700 9.5px var(--mono); text-transform: uppercase; }
.dot { width: 10px; height: 10px; flex-shrink: 0; border-radius: 2px; border: 2px solid var(--line); background: transparent; }
.sidebar a.done .dot { background: var(--led); border-color: var(--led); box-shadow: 0 0 8px var(--led); }

.content { flex: 1; min-width: 0; max-width: 900px; margin: 0 auto; padding: 34px 40px 80px; }
.crumbs { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font: 600 12.5px var(--mono); background: var(--panel); border: 1px solid var(--line); padding: 4px 10px; border-radius: 6px; }
.content h1 { font: 800 clamp(27px, 3.8vw, 38px)/1.18 var(--mono); letter-spacing: -.04em; margin: 14px 0 26px; color: var(--text); }
.content h1::before { content: '>'; color: var(--brand); margin-right: .35em; }

/* ---------- treść lekcji ---------- */
.lesson { counter-reset: sek; }
.lesson h2 { font: 800 24px/1.25 var(--mono); letter-spacing: -.035em; margin: 50px 0 12px; scroll-margin-top: 80px; display: flex; gap: 12px; align-items: baseline; }
.lesson h2::before { counter-increment: sek; content: counter(sek, decimal-leading-zero); font: 700 12px var(--mono); color: #04150c; background: var(--led); padding: 3px 7px; border-radius: 4px; flex-shrink: 0; position: relative; top: -3px; }
.lesson h3 { font: 700 19px/1.3 var(--mono); letter-spacing: -.025em; margin: 32px 0 8px; scroll-margin-top: 80px; }
.lesson h3::before { content: '# '; color: var(--brand-2); }
.lesson h4 { font-size: 17px; margin: 22px 0 6px; }
.lesson p, .lesson li { color: var(--text); }
.lesson ul, .lesson ol { padding-left: 24px; }
.lesson li { margin: 4px 0; }
.lesson ul > li::marker { content: '▪  '; color: var(--brand); }
.lesson ol > li::marker { color: var(--brand); font: 700 .9em var(--mono); }
.lesson :not(pre) > code { background: var(--inline-code); padding: 1px 6px; border-radius: 4px; font-size: .86em; color: var(--inline-fg); border: 1px solid var(--line); }
.lesson hr { border: 0; height: 2px; margin: 38px 0; background: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 14px); }
.lesson img { max-width: 100%; border-radius: 8px; }

.code { margin: 18px 0; border-radius: 10px; overflow: hidden; background: var(--code-bg); border: 1px solid #1c2c31; box-shadow: 0 14px 34px rgba(4, 16, 12, .18); }
.code-bar { display: flex; justify-content: space-between; align-items: center; padding: 7px 12px; background: #0c171b; border-bottom: 1px solid #1c2c31; color: #8aa19c; font: 700 11.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.code-bar span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: #39e58c; box-shadow: 0 0 6px #39e58c, 14px 0 0 #ffb627, 28px 0 0 #ff5d5d; margin-right: 40px; vertical-align: 0; }
.copy { background: transparent; color: #cfe2dd; border: 1px solid #2a3c42; border-radius: 5px; padding: 3px 10px; cursor: pointer; font: 600 11.5px var(--mono); }
.copy:hover { border-color: #39e58c; color: #39e58c; }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: 14px; line-height: 1.6; color: #d7e6e2; }
.code pre code.hljs { padding: 0; background: transparent; }
.demo { margin: -10px 0 22px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; overflow: hidden; background: #fff; }
.demo-bar { font: 700 11.5px var(--mono); color: #0c9a5b; padding: 7px 14px; background: #ecf8f2; letter-spacing: .06em; text-transform: uppercase; border-bottom: 1px dashed #cfe5da; }
.demo iframe { width: 100%; height: 150px; border: 0; display: block; background: #fff; }

.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: 8px; }
.lesson table { border-collapse: collapse; width: 100%; font-size: 15px; background: var(--panel); }
.lesson th { background: var(--panel2); text-align: left; font: 700 13px var(--mono); text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.lesson th, .lesson td { padding: 9px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lesson tr:last-child td { border-bottom: 0; }
.lesson tbody tr:hover td { background: var(--panel2); }

.box { position: relative; border-radius: var(--radius); padding: 14px 18px 12px; margin: 22px 0; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c); box-shadow: 0 6px 18px rgba(4, 16, 12, .05); }
.box-title { display: inline-block; font: 800 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--c); margin-bottom: 2px; }
.box p:first-of-type { margin-top: 4px; }
.box p:last-child { margin-bottom: 4px; }
.box-tip { --c: var(--tip); } .box-uwaga { --c: var(--uwaga); } .box-egzamin { --c: var(--egzamin); }
.box-info { --c: var(--info); } .box-zadanie { --c: var(--zadanie); }
.box-egzamin { background: linear-gradient(135deg, rgba(10, 139, 176, .08), var(--panel) 60%); }
.box-uwaga { background: linear-gradient(135deg, rgba(199, 122, 0, .07), var(--panel) 60%); }

details.reveal { margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
details.reveal summary { cursor: pointer; padding: 11px 16px; font: 700 14.5px var(--mono); color: var(--brand); list-style: none; }
details.reveal summary::-webkit-details-marker { display: none; }
details.reveal summary::before { content: '[+] '; }
details.reveal[open] summary::before { content: '[−] '; }
details.reveal[open] { border-color: var(--brand); }
.reveal-body { padding: 0 16px 8px; border-top: 1px dashed var(--line); }

.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.btn-download { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font: 600 13.5px var(--mono); text-decoration: none; }
.btn-download:hover { border-color: var(--brand); }
.file-name { margin: 18px 0 -10px; font: 600 12.5px var(--mono); color: var(--muted); }
.lesson li.check { list-style: none; margin-left: -22px; }
.lesson li.check::marker { content: ''; }
.lesson li.check input { width: 17px; height: 17px; accent-color: var(--tip); vertical-align: -3px; margin-right: 6px; }
.lesson li.check label { cursor: pointer; }

.done-row { margin: 40px 0 10px; text-align: center; }
.btn-done { background: var(--panel); color: var(--tip); border: 2px solid var(--tip); padding: 12px 24px; border-radius: 8px; font: 700 14.5px var(--mono); cursor: pointer; transition: .2s; }
.btn-done:hover, .btn-done.is-done { background: var(--tip); color: #04150c; box-shadow: 0 0 20px rgba(34, 196, 111, .35); }

.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); text-decoration: none; font-weight: 600; font-size: 14px; max-width: 48%; color: var(--text); transition: border-color .2s, transform .2s; }
.pager a::before { content: 'poprzednia lekcja'; display: block; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.pager a.next::before { content: 'następna lekcja'; }
.pager a:hover { border-color: var(--brand); transform: translateY(-2px); }
.pager a.next { margin-left: auto; text-align: right; }

.locked-box { text-align: center; padding: 40px 24px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(4, 16, 12, .08); position: relative; overflow: hidden; }
.locked-box::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: repeating-linear-gradient(90deg, #ffb627 0 14px, #13201c 14px 28px); }
.locked-box h2 { font: 800 22px var(--mono); letter-spacing: -.03em; }
.locked-box.small { margin-top: 40px; padding: 28px; }
.locked-icon { font-size: 50px; }
.muted { color: var(--muted); font-size: 14px; }

/* ---------- quiz ---------- */
.quiz-q { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin: 14px 0; }
.quiz-q h4 { margin: 0 0 10px; font-size: 16px; }
.quiz-q h4 small { font: 700 11.5px var(--mono); color: var(--brand-2); margin-right: 8px; }
.quiz-q label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.quiz-q label:hover { background: var(--inline-code); }
.quiz-q input { accent-color: var(--brand); }
.quiz-q label.ok { background: rgba(34, 196, 111, .12); border-color: var(--tip); }
.quiz-q label.bad { background: rgba(220, 60, 60, .1); border-color: #d64545; }
.quiz-q .why { display: none; margin-top: 8px; font-size: 14px; color: var(--muted); }
.quiz.checked .why { display: block; }
.quiz-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 18px; }
.quiz-actions button { background: var(--led); color: #04150c; border: 0; padding: 11px 20px; border-radius: 8px; font: 700 14.5px var(--mono); cursor: pointer; box-shadow: 0 6px 18px rgba(34, 196, 111, .25); }
.quiz-actions button:hover { filter: brightness(1.08); }
.quiz-actions button.secondary { background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.quiz-score { font: 800 18px var(--mono); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 120px); background: var(--bar); color: #e2eeea; border: 1px solid rgba(57,229,140,.45); padding: 11px 18px; border-radius: 8px; font: 600 14px var(--mono); transition: transform .3s; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.toast.show { transform: translate(-50%, 0); }

@media (max-width: 960px) {
  .menu-btn { display: block; }
  .sidebar { position: fixed; left: 0; top: 60px; z-index: 15; transform: translateX(-100%); transition: transform .25s; box-shadow: 10px 0 40px rgba(0,0,0,.25); }
  .sidebar.open { transform: none; }
  .content { padding: 24px 16px 60px; }
  .progress-bar { width: 70px; }
  .btn-ghost { font-size: 12.5px; padding: 6px 10px; white-space: nowrap; }
}
@media (max-width: 560px) {
  .progress { display: none; }
  .btn-buy { margin-left: auto; padding: 7px 10px; font-size: 12px; }
  .topbar { gap: 8px; padding: 0 10px; }
  .brand { font-size: 0; gap: 0; }
  .brand .brand-badge { display: none; }
  .menu-btn { font-size: 18px; width: 34px; }
  .topbar .btn-ghost { padding: 6px 8px; font-size: 12px; }
  .topbar .buy-price { display: none; }
  .lesson h2 { font-size: 21px; }
}
@media (max-width: 380px) {
  .btn-syntax .syn-label { display: none; }
}

/* ---- linki do słownika ---- */
.lesson a.syn { text-decoration: none; }
.lesson a.syn code { border-bottom: 2px dotted var(--brand-2); cursor: help; transition: background .15s, color .15s; }
.lesson a.syn:hover code { background: var(--brand-2); color: #fff; border-color: transparent; }
.lesson a.syn:hover code::after { content: " ↗"; font-size: .8em; }
.syn-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 9px 14px 11px; border-top: 1px solid #1c2c31; background: #081215; font-size: 12.5px; }
.syn-bar span { color: #8aa19c; margin-right: 2px; font-family: var(--mono); }
.syn-bar a { font-family: var(--mono); color: #bff5d6; text-decoration: none; padding: 1px 8px; border-radius: 4px; background: rgba(57, 229, 140, .1); border: 1px solid rgba(57, 229, 140, .28); line-height: 1.6; }
.syn-bar a:hover { background: #39e58c; color: #04150c; }
.btn-syntax { text-decoration: none; white-space: nowrap; color: #e2eeea; font: 700 13.5px var(--mono); padding: 7px 13px; border-radius: 6px; border: 1px solid rgba(56, 200, 240, .55); background: rgba(56, 200, 240, .08); margin-left: auto; margin-right: 10px; }
.btn-syntax:hover { background: #38c8f0; color: #04150c; }
@media (max-width: 560px) { .topbar .hide-sm { display: none; } }
@media (max-width: 700px) { .btn-syntax { font-size: 12px; padding: 6px 9px; margin-right: 6px; } }

/* diagramy tekstowe (ramki ┌─┐│) – ciasna interlinia, żeby pionowe kreski się stykały */
.code pre code.language-plaintext { line-height: 1.32; }

/* ---------- reset postępu (dół lekcji) ---------- */
.reset-box { margin: 46px 0 10px; padding: 14px 18px; border: 1px dashed var(--line); border-radius: var(--radius); display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; color: var(--muted); font-size: 14px; line-height: 1.5; }
.reset-box span { flex: 1 1 260px; }
.btn-reset { background: transparent; color: #d64545; border: 1px solid #d64545; border-radius: 6px; padding: 7px 13px; font: 600 13px var(--mono); cursor: pointer; white-space: nowrap; }
.btn-reset:hover { background: #d64545; color: #fff; }

/* ---------- quiz: wyjaśnienia odpowiedzi ---------- */
.quiz-q .why p { margin: 4px 0; line-height: 1.5; }
.quiz-q .why .why-wrong { color: #d64545; }
.quiz-q .why .why-ok { color: var(--tip); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
