/* ============ MATLAB na zajęcia – style ============ */
:root {
  --bg: #f6f4ef;
  --bg-2: #efece4;
  --panel: #ffffff;
  --ink: #1b1d22;
  --ink-2: #3a3e47;
  --muted: #6d717b;
  --line: #e3dfd5;
  --line-2: #d6d1c4;
  --accent: #d9622b;
  --accent-ink: #b44a17;
  --accent-soft: #fbe9df;
  --blue: #0b6bcb;
  --blue-soft: #e5f0fb;
  --ok: #1f8a4c;
  --ok-soft: #e3f4ea;
  --err: #c2372b;
  --err-soft: #fbe7e4;
  --warn: #9a6a09;
  --warn-soft: #fbf1d9;
  --code-bg: #ffffff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(27, 29, 34, .05), 0 6px 24px -12px rgba(27, 29, 34, .18);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --top-h: 60px;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 16px); }
code, pre, textarea, .editor, .console, .mono { font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .86em; background: var(--bg-2); border: 1px solid var(--line); padding: .05em .38em; border-radius: 5px; color: #2b2d33; white-space: nowrap; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.015em; margin: 0; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.grow { flex: 1; }

/* ---------- Pasek górny ---------- */
.top { position: sticky; top: 0; z-index: 50; background: rgba(246, 244, 239, .86); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1320px; margin: 0 auto; height: var(--top-h); display: flex; align-items: center; gap: 22px; padding: 0 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand-t { font-size: 16px; letter-spacing: -.01em; }
.brand-t b { font-weight: 800; }
.nav { display: flex; gap: 4px; margin-left: 10px; }
.nav a { color: var(--ink-2); font-weight: 600; font-size: 14.5px; padding: 7px 12px; border-radius: 999px; text-decoration: none; }
.nav a:hover { background: var(--bg-2); }
.nav a.active { background: var(--ink); color: #fff; }
.progress-pill { margin-left: auto; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.ring { --p: 0; width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line-2) 0); mask: radial-gradient(circle 7px, transparent 98%, #000 100%); -webkit-mask: radial-gradient(circle 7px, transparent 98%, #000 100%); }
.menu-btn { display: none; background: none; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; }

.main { max-width: 1320px; margin: 0 auto; padding: 28px 22px 80px; }

/* ---------- Przyciski ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 13.5px; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; text-decoration: none !important; white-space: nowrap; line-height: 1.2; }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; }
.btn-run { background: var(--accent); color: #fff; }
.btn-run:hover { background: var(--accent-ink); }
.btn-run.is-stop { background: var(--ink); }
.btn-run:disabled { opacity: .7; cursor: progress; }
.btn-secondary { background: var(--panel); border-color: var(--line-2); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-ghost.ok { color: var(--ok); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.icon-only { padding: 7px 9px; }
.link-btn { background: none; border: 0; color: var(--blue); font-weight: 600; font-size: 13px; cursor: pointer; padding: 0; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; }
.icon-btn:hover { color: var(--err); background: var(--err-soft); }
.busy { position: relative; }

/* ---------- Strona główna ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; padding: 26px 0 40px; }
.eyebrow { font-size: 12.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 700; color: var(--accent-ink); margin-bottom: 12px; }
.hero h1 { font-size: clamp(36px, 5vw, 60px); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; }
.hero h1 em { font-style: normal; color: var(--accent); position: relative; }
.lead { font-size: 18px; color: var(--ink-2); max-width: 620px; margin: 18px 0 26px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-cta.center { justify-content: center; }
.hero-side { display: grid; gap: 16px; }
.hero-mock { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transform: rotate(.6deg); }
.mock-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #faf9f6; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.mock-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.mock-bar span { margin-left: 8px; }
.hero-mock pre { margin: 0; padding: 14px 16px; font: 13px/1.6 var(--mono); }
.mock-con { border-top: 1px dashed var(--line); padding: 12px 16px; font: 13px/1.6 var(--mono); background: #fcfcfb; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.stats b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.stats span { font-size: 12.5px; color: var(--muted); }
.block { margin-top: 26px; }
.block-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 16px; flex-wrap: wrap; }
.block-head h2 { font-size: 28px; font-weight: 800; }
.block-head p { margin: 0; color: var(--muted); max-width: 520px; }
.l-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.l-card { display: flex; flex-direction: column; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px; color: var(--ink); text-decoration: none !important; transition: border-color .15s, transform .15s, box-shadow .15s; }
.l-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.l-card-top { display: flex; align-items: center; gap: 10px; }
.l-num { font: 600 12px var(--mono); color: var(--muted); }
.l-kind { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.l-card h3 { font-size: 18px; font-weight: 800; }
.l-card p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.l-meta { margin-top: auto; padding-top: 6px; font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; }
.mini-ring { --p: 0; margin-left: auto; width: 22px; height: 22px; flex: none; border-radius: 50%; background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--line) 0); position: relative; }
.mini-ring::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--panel); }
.mini-ring.full::after { background: var(--ok); inset: 4px; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3.2 3L13 4.5' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; }
.mini-ring.full { background: var(--ok-soft); }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 36px; }
.how-item { padding: 18px; border-top: 2px solid var(--ink); }
.how-n { font: 700 12px var(--mono); color: var(--accent-ink); }
.how-item h4 { font-size: 17px; margin: 6px 0 6px; font-weight: 800; }
.how-item p { margin: 0; color: var(--ink-2); font-size: 14px; }
.foot-note { margin-top: 40px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Lekcja ---------- */
.with-side { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; }
.side { position: sticky; top: calc(var(--top-h) + 20px); align-self: start; max-height: calc(100vh - var(--top-h) - 40px); overflow: auto; display: flex; flex-direction: column; gap: 2px; padding-bottom: 20px; }
.side-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 800; color: var(--muted); padding: 14px 10px 6px; }
.side-title:first-child { padding-top: 0; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); text-decoration: none !important; font-weight: 600; font-size: 14px; line-height: 1.25; }
.side-item small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.side-item:hover { background: var(--bg-2); }
.side-item.active { background: var(--panel); border: 1px solid var(--line); color: var(--ink); }
.side-item .mini-ring { margin-left: 0; width: 18px; height: 18px; }
.side-item .mini-ring::after { inset: 3.5px; }
.side-item.active .mini-ring::after { background: var(--panel); }
.side-ic { width: 18px; display: inline-flex; justify-content: center; color: var(--muted); }
.lesson { min-width: 0; max-width: 860px; }
.lesson-head h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 800; letter-spacing: -.03em; }
.goal { font-size: 16.5px; color: var(--ink-2); margin: 14px 0 10px; }
.src { font-size: 13px; color: var(--muted); }
.toc { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.toc a { font-size: 13.5px; font-weight: 700; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); background: var(--panel); text-decoration: none; }
.toc a:hover { border-color: var(--ink-2); }
.part-head { margin: 56px 0 18px; padding-top: 22px; border-top: 1px solid var(--line-2); }
.part-head.first { margin-top: 32px; }
.part-k { font: 700 12px var(--mono); color: var(--accent-ink); text-transform: uppercase; letter-spacing: .06em; }
.part-head h2 { font-size: 26px; font-weight: 800; margin-top: 4px; }
.part-head p { margin: 6px 0 0; color: var(--muted); }
.sec-h { font-size: 21px; font-weight: 800; margin: 36px 0 10px; }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0 0 12px; padding-left: 20px; }
.prose li { margin: 4px 0; }
.formula { font-family: 'Times New Roman', Georgia, serif; font-size: 21px; text-align: center; padding: 14px; margin: 10px 0 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tbl-wrap { overflow-x: auto; margin: 10px 0 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.tbl { border-collapse: collapse; width: 100%; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; padding: 10px 14px; background: #faf9f6; border-bottom: 1px solid var(--line); }
.tbl td { padding: 9px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl tr:first-child td { border-top: 0; }
.tbl td code { white-space: nowrap; }
.callout { border-radius: var(--radius-sm); padding: 14px 16px 14px 18px; margin: 14px 0 18px; font-size: 14.5px; border: 1px solid; position: relative; }
.callout.info { background: var(--blue-soft); border-color: #c9def3; }
.callout.tip { background: var(--ok-soft); border-color: #c4e5d1; }
.callout.warn { background: var(--warn-soft); border-color: #f0dca8; }
.callout code { background: rgba(255, 255, 255, .7); }
.ide-diagram { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 6px; margin: 12px 0 14px; padding: 6px; background: var(--ink); border-radius: 12px; }
.ide-diagram > div { background: #fff; border-radius: 8px; padding: 12px; min-height: 108px; display: flex; flex-direction: column; gap: 4px; }
.ide-diagram b { font-size: 13.5px; }
.ide-diagram span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.ide-diagram .mid { background: #fffdf9; }
.subplot-demo { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-width: 360px; margin: 10px 0 16px; }
.subplot-demo div { border: 1.5px solid var(--ink); border-radius: 6px; height: 64px; display: flex; align-items: center; justify-content: center; background: #fff; }
.subplot-demo span { font: 12px var(--mono); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.pill-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.pill-card b { display: block; }
.pill-card span { color: var(--muted); font-size: 13.5px; }
.division { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 6px 22px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 6px 0 12px; font-family: var(--mono); font-size: 13.5px; }
.division b { color: var(--accent-ink); }
.division.mono { grid-template-columns: repeat(2, auto); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 50px; }
.pg { display: flex; flex-direction: column; padding: 14px 18px; border: 1px solid var(--line-2); border-radius: var(--radius); min-width: 200px; background: var(--panel); color: var(--ink); text-decoration: none !important; }
.pg:hover { border-color: var(--ink-2); }
.pg small { color: var(--muted); font-weight: 600; }
.pg span { font-weight: 800; font-size: 16px; }
.pg.next { text-align: right; }

/* ---------- Edytor ---------- */
.editor { display: flex; background: var(--code-bg); font: 13.5px/20px var(--mono); position: relative; }
.ed-gutter { flex: none; padding: 12px 8px 12px 12px; text-align: right; color: #a9a59b; user-select: none; background: #faf9f6; border-right: 1px solid var(--line); min-width: 42px; }
.ed-gutter span { display: block; height: 20px; }
.ed-gutter span.err { color: #fff; background: var(--err); border-radius: 4px; margin: 0 -4px 0 -2px; padding: 0 4px 0 2px; }
.ed-area { position: relative; flex: 1; min-width: 0; }
.ed-hl, .ed-ta { position: absolute; inset: 0; margin: 0; padding: 12px 14px; font: inherit; white-space: pre; overflow: hidden; tab-size: 4; border: 0; }
.ed-hl { pointer-events: none; color: #1b1d22; }
.ed-ta { resize: none; background: transparent; color: transparent; caret-color: #1b1d22; outline: none; overflow-x: auto; overflow-y: hidden; width: 100%; height: 100%; }
.ed-ta::selection { background: rgba(11, 107, 203, .22); color: transparent; }
.editor:focus-within { box-shadow: inset 0 0 0 2px rgba(217, 98, 43, .35); }
/* kolory jak w edytorze MATLAB-a */
.t-k { color: #0e00ff; }
.t-s { color: #a709f5; }
.t-c { color: #028009; }
.t-n { color: #1b1d22; }
.t-f { color: #1b1d22; }
.code-static { margin: 0; font: 13.5px/1.55 var(--mono); padding: 14px 16px; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow-x: auto; }
.code-static.syntax { margin: 8px 0 16px; border-left: 3px solid var(--accent); }

/* ---------- Komórka z kodem ---------- */
.cell { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0 20px; overflow: hidden; box-shadow: 0 1px 0 rgba(0, 0, 0, .02); }
.cell-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--line); background: #fcfbf8; flex-wrap: wrap; }
.cell-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.cell-actions { display: flex; align-items: center; gap: 4px; }
.tag { font: 600 11px var(--mono); padding: 2px 7px; border-radius: 999px; }
.tag-input { background: var(--blue-soft); color: var(--blue); }
.cell-out { border-top: 1px solid var(--line); background: #fcfcfb; }
.cell-note { padding: 10px 16px 12px; font-size: 13.5px; color: var(--ink-2); border-top: 1px dashed var(--line); background: #fffdf8; }
.cell-note::before { content: 'Spróbuj: '; font-weight: 800; color: var(--accent-ink); }

/* ---------- Konsola ---------- */
.console { font: 13px/1.5 var(--mono); padding: 12px 16px; max-height: 360px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.cell-out .console:empty, .con-body:empty { display: none; }
.c-out { color: #1b1d22; }
.c-prompt { color: #1b1d22; }
.c-echo { color: var(--blue); font-weight: 600; }
.c-err { color: var(--err); font-weight: 500; }
.c-hint { color: #7a5a06; display: block; width: fit-content; max-width: 100%; background: var(--warn-soft); border-radius: 6px; padding: 4px 9px; margin: 4px 0; white-space: normal; font-family: var(--sans); font-size: 13px; }
.c-hint::before { content: '💡 '; }
.c-warn { color: var(--warn); }
.c-muted { color: var(--muted); font-style: italic; }
.c-cmd { color: #5c5f66; }
.con-in-wrap { display: inline-flex; align-items: center; gap: 8px; }
.con-in { font: inherit; border: 0; border-bottom: 2px solid var(--blue); background: var(--blue-soft); padding: 1px 6px; outline: none; min-width: 160px; color: var(--blue); font-weight: 600; border-radius: 4px 4px 0 0; }
.con-in-hint { font: 11px var(--sans); color: var(--muted); }
.console.waiting { box-shadow: inset 3px 0 0 var(--blue); }

/* ---------- Wykresy ---------- */
.figs { display: grid; gap: 12px; padding: 0 16px 14px; }
.figs:empty { display: none; }
.fig-card { margin: 0; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #f0f0f0; }
.fig-card figcaption { font: 600 12px var(--sans); padding: 6px 10px; background: #e8e8e8; border-bottom: 1px solid #d6d6d6; display: flex; align-items: center; gap: 7px; color: #333; }
.fig-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.fig-card canvas { display: block; max-width: 100%; }
.figs-empty { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 30px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- Zadania ---------- */
.exercise { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin: 18px 0 26px; overflow: hidden; }
.ex-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 16px 18px 6px; }
.ex-kicker { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.ex-head h3 { font-size: 18.5px; font-weight: 800; margin-top: 4px; }
.lvl { font-size: 11px; padding: 1px 8px; border-radius: 999px; letter-spacing: .02em; text-transform: none; }
.lvl-easy { background: var(--ok-soft); color: var(--ok); }
.lvl-mid { background: var(--warn-soft); color: var(--warn); }
.ex-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.ex-status.ok { color: var(--ok); border-color: #b8dfc7; background: var(--ok-soft); }
.ex-task { padding: 0 18px 12px; font-size: 14.5px; }
.ex-task p { margin: 6px 0; }
.ex-task ul { margin: 6px 0; padding-left: 20px; }
.ex-task .sample, pre.sample { font: 13px var(--mono); background: var(--bg-2); padding: 8px 12px; border-radius: 8px; margin: 8px 0; }
.exercise .editor { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ex-actions { display: flex; align-items: center; gap: 6px; padding: 10px 14px; flex-wrap: wrap; background: #fcfbf8; }
.ex-hint { display: flex; gap: 10px; padding: 12px 18px; background: var(--warn-soft); border-top: 1px solid #f0dca8; font-size: 14px; color: #5f4706; }
.ex-hint svg { flex: none; margin-top: 3px; }
.ex-results { padding: 14px 18px; border-top: 1px solid var(--line); position: relative; overflow: hidden; }
.ex-sum { font-weight: 800; font-size: 15px; margin-bottom: 10px; }
.ex-sum.ok { color: var(--ok); }
.ex-sum.bad { color: var(--err); }
.tests { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tests li { display: flex; gap: 10px; padding: 8px 12px; border-radius: 9px; font-size: 14px; }
.tests li.ok { background: var(--ok-soft); }
.tests li.bad { background: var(--err-soft); }
.ti { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; color: #fff; margin-top: 1px; }
.tests li.ok .ti { background: var(--ok); }
.tests li.bad .ti { background: var(--err); }
.tn { font-weight: 700; }
.tm { color: #7d241b; font-size: 13.5px; margin-top: 2px; }
.tdet { margin-top: 6px; font-size: 13px; }
.tdet summary { cursor: pointer; color: var(--ink-2); font-weight: 600; }
.tdet pre { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: 12.5px/1.45 var(--mono); max-height: 220px; overflow: auto; white-space: pre-wrap; margin: 6px 0 0; }
.tin { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ex-solution { border-top: 1px solid var(--line); padding: 14px 18px; background: #fafcff; }
.sol-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -10px; left: var(--x); width: 8px; height: 12px; border-radius: 2px; animation: fall 1.4s var(--d) ease-in forwards; transform: rotate(var(--r)); }
@keyframes fall { to { transform: translateY(240px) rotate(calc(var(--r) + 540deg)); opacity: 0; } }

/* ---------- Quiz ---------- */
.quiz { display: grid; gap: 14px; }
.quiz-score { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-2); }
.q { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.q.big { padding: 24px; }
.q-n { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.q-text { font-size: 16px; font-weight: 700; margin: 6px 0 12px; }
.q.big .q-text { font-size: 19px; }
.q-opts { display: grid; gap: 7px; }
.q-opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; cursor: pointer; font-size: 14.5px; transition: border-color .12s, background .12s; }
.q-opt:hover:not(:disabled) { border-color: var(--ink-2); background: #fcfbf8; }
.q-opt:disabled { cursor: default; }
.q-letter { width: 24px; height: 24px; border-radius: 7px; background: var(--bg-2); display: inline-flex; align-items: center; justify-content: center; font: 700 12px var(--mono); flex: none; }
.q-opt.right { border-color: var(--ok); background: var(--ok-soft); }
.q-opt.right .q-letter { background: var(--ok); color: #fff; }
.q-opt.wrong { border-color: var(--err); background: var(--err-soft); }
.q-opt.wrong .q-letter { background: var(--err); color: #fff; }
.q-why { margin-top: 10px; padding: 10px 12px; border-radius: 9px; font-size: 14px; }
.q-why.ok { background: var(--ok-soft); }
.q-why.bad { background: var(--err-soft); }
.q-next { margin-top: 14px; display: flex; justify-content: flex-end; }

/* ---------- Test ---------- */
.page { max-width: 1100px; margin: 0 auto; }
.page.narrow { max-width: 780px; }
.page h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 800; letter-spacing: -.03em; }
.page h3 { margin: 30px 0 12px; font-size: 18px; font-weight: 800; }
.test-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-card { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: border-color .15s, transform .15s; }
.mode-card:hover { border-color: var(--ink-2); transform: translateY(-2px); }
.mode-card b { font-size: 17px; }
.mode-card span { color: var(--ink-2); font-size: 14px; }
.mode-card i { font-style: normal; color: var(--accent-ink); font-weight: 700; font-size: 13px; margin-top: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 4px 11px; font: 600 12.5px var(--mono); cursor: pointer; }
.chip:hover { border-color: var(--ink-2); }
.chip.big { font-family: var(--sans); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; align-items: flex-start; text-align: left; }
.chip.big b { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-ink); }
.chip.big span { font-size: 14px; font-weight: 700; }
.flash { display: grid; gap: 8px; }
.flash-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.flash-card summary { cursor: pointer; font-weight: 700; }
.flash-card p { margin: 8px 0 2px; color: var(--ink-2); font-size: 14.5px; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.result { text-align: center; padding: 30px 0 10px; }
.result h2 { font-size: 30px; font-weight: 800; margin-top: 18px; }
.big-ring { --p: 0; width: 150px; height: 150px; border-radius: 50%; margin: 0 auto; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); display: flex; align-items: center; justify-content: center; position: relative; }
.big-ring::before { content: ''; position: absolute; inset: 14px; border-radius: 50%; background: var(--bg); }
.big-ring b { position: relative; font-size: 34px; font-weight: 800; }
.review { margin-top: 30px; display: grid; gap: 10px; }
.rev-item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.rev-item .q-text { margin: 0 0 8px; font-size: 15px; }
.rev-a { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.rev-a .bad { color: var(--err); }
.rev-a .ok { color: var(--ok); font-weight: 700; }
.rev-item p { margin: 6px 0; font-size: 13.5px; }

/* ---------- Ściąga ---------- */
.cheat-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.cheat { columns: 3 320px; column-gap: 14px; }
.cheat-card { break-inside: avoid; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.cheat-card h3 { font-size: 15px; font-weight: 800; margin: 0 0 8px; color: var(--accent-ink); }
.cheat-card table { border-collapse: collapse; width: 100%; font-size: 13px; }
.cheat-card td { padding: 5px 0; border-top: 1px solid var(--line); vertical-align: top; }
.cheat-card tr:first-child td { border-top: 0; }
.cheat-card td:first-child { padding-right: 10px; width: 52%; }
.cheat-card td code { white-space: normal; word-break: break-word; }
.cheat-card .code-static { font-size: 12.5px; border: 0; padding: 0; }

/* ---------- Widżety ---------- */
.widget { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 12px 0 22px; }
.widget-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; }
.num-in { font: 600 14px var(--mono); width: 90px; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 8px; }
.num-in.wide { width: 140px; }
.bits { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.bit { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0 8px; border: 1.5px solid var(--line-2); border-radius: 10px; background: #fff; cursor: pointer; transition: all .12s; }
.bit b { font: 700 24px var(--mono); }
.bit small { font: 11px var(--mono); color: var(--muted); }
.bit .w { color: var(--ink-2); font-weight: 600; }
.bit.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.bit.on small { color: #c9c9c9; }
.bit:first-child { box-shadow: inset 0 -3px 0 var(--accent); }
.bits-out, .ieee-info { margin-top: 12px; display: grid; gap: 4px; font: 13.5px/1.6 var(--mono); }
.lbl { font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: inline-block; width: 104px; }
.ieee-row { display: flex; gap: 4px; flex-wrap: wrap; }
.seg { display: flex; flex-direction: column; align-items: center; padding: 8px 10px; border-radius: 9px; font: 600 15px var(--mono); letter-spacing: .08em; }
.seg small { font: 600 11px var(--sans); letter-spacing: 0; opacity: .8; }
.seg.sgn { background: #fde4e0; color: #8f2a1f; }
.seg.exp { background: #e2eefb; color: #0a4f97; }
.seg.man { background: #e4f3e9; color: #1b6a3d; flex: 1; word-break: break-all; }
.warnline { color: var(--warn); font-family: var(--sans); }
.okline { color: var(--ok); font-family: var(--sans); }

/* ---------- Laboratorium ---------- */
.lab { display: flex; flex-direction: column; gap: 12px; }
.lab-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.lab-title b { font-size: 22px; font-weight: 800; margin-right: 10px; }
.lab-title span { color: var(--muted); font-size: 13.5px; }
.lab-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sel { font: 600 13.5px var(--sans); padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; cursor: pointer; max-width: 260px; }
.lab-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); grid-template-rows: auto auto; grid-template-areas: 'ed fig' 'cmd ws'; gap: 12px; }
.pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.pane-ed { grid-area: ed; }
.pane-cmd { grid-area: cmd; }
.pane-ws { grid-area: ws; }
.pane-fig { grid-area: fig; }
.pane-h { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); background: #faf9f6; border-bottom: 1px solid var(--line); }
.pane-h small { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--muted); }
.pane-h.sub { border-top: 1px solid var(--line); }
.pane-ed .editor { flex: 1; max-height: 560px; overflow: auto; }
.cmdwin { max-height: 340px; min-height: 240px; flex: 1; cursor: text; }
.cmd-line { display: flex; align-items: center; gap: 8px; }
.cmd-line.busy { opacity: .45; pointer-events: none; }
.cmd-prompt { color: var(--ink); font-weight: 600; }
.cmd-in { flex: 1; font: inherit; border: 0; outline: none; background: transparent; padding: 2px 0; color: var(--ink); }
.cmd-in::placeholder { color: #b7b3a8; }
.ws-wrap { max-height: 220px; overflow: auto; }
.ws { width: 100%; border-collapse: collapse; font: 12.5px var(--mono); }
.ws th { position: sticky; top: 0; background: #fff; text-align: left; font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line); }
.ws td { padding: 5px 10px; border-bottom: 1px solid #f1eee7; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.ws tr:not(.empty) { cursor: pointer; }
.ws tr:not(.empty):hover td { background: var(--blue-soft); }
.ws tr.empty td { color: var(--muted); font-family: var(--sans); padding: 14px 10px; }
.ws-name { font-weight: 700; }
.ws-cls { color: var(--muted); }
.files { padding: 8px 12px 12px; display: grid; gap: 4px; }
.file { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.file-name { background: none; border: 0; font: 600 12.5px var(--mono); color: var(--blue); cursor: pointer; padding: 0; }
.file small { color: var(--muted); margin-left: auto; }
.lab-figs { padding: 12px; }
.pane-fig .figs { max-height: 640px; overflow: auto; }

/* ---------- Responsywność ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-mock { transform: none; }
  .with-side { grid-template-columns: 1fr; }
  .side { display: none; }
  .menu-btn { display: inline-flex; }
  .lab-grid { grid-template-columns: 1fr; grid-template-areas: 'ed' 'cmd' 'fig' 'ws'; }
}
@media (max-width: 760px) {
  .top { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .top-in { gap: 10px; padding: 0 14px; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); justify-content: space-around; margin: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 60; }
  .nav a { font-size: 12.5px; padding: 7px 9px; }
  .main { padding: 18px 14px 100px; }
  .brand-t { font-size: 15px; }
  .how, .test-modes, .stats { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .ide-diagram { grid-template-columns: 1fr; }
  .bits { gap: 3px; }
  .bit b { font-size: 18px; }
  .cell-actions .btn span { display: none; }
  .cell-actions .btn-run span { display: inline; }
  .ex-actions .btn-ghost span { display: none; }
  .pager { flex-direction: column; }
  .pg { min-width: 0; }
  .division { grid-template-columns: repeat(2, auto); }
}

/* ---------- Druk (ściąga) ---------- */
@media print {
  .top, .cheat-head button, .nav { display: none !important; }
  body { background: #fff; font-size: 11px; }
  .main { padding: 0; max-width: none; }
  .cheat { columns: 3; }
  .cheat-card { border: 1px solid #ccc; padding: 8px; margin-bottom: 8px; }
}

/* kod zawsze bez ligatur – == ma wyglądać jak dwa znaki = */
code, pre, textarea, .editor, .ed-hl, .ed-ta, .console, .con-in, .cmd-in, .mono, .code-static { font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; }

/* ---------- Menu (hamburger) ---------- */
.menu-btn { align-items: center; justify-content: center; color: var(--ink); }
.menu-btn:hover { background: var(--bg-2); }
.menu-btn[aria-expanded="true"] { background: var(--ink); color: #fff; }
.drawer-bg { position: fixed; inset: 0; background: rgba(27, 29, 34, .32); z-index: 70; animation: fadeIn .15s; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); background: var(--bg); border-right: 1px solid var(--line); z-index: 80; overflow-y: auto; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 2px; box-shadow: 0 0 40px rgba(0, 0, 0, .18); animation: slideIn .2s ease-out; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 4px 10px; height: 44px; }
.drawer-head b { font-size: 16px; }
.close-btn:hover { color: var(--ink); background: var(--bg-2); }
.drawer .side-title:nth-child(2) { padding-top: 6px; }
.drawer .side-item.active .mini-ring::after { background: var(--panel); }
body.menu-open { overflow: hidden; }
@keyframes slideIn { from { transform: translateX(-100%); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 1081px) { .drawer, .drawer-bg { display: none !important; } }
