/* matura.michalski.uk — mobile-first (2026-09-14: stabilny layout na
   telefonie; safe-areas; tap-targety ≥44 px; brak auto-zoomu iOS;
   PWA standalone). */
:root {
  --bg: #101418; --panel: #181e24; --panel2: #1f2730; --line: #2c3742;
  --fg: #e8edf2; --muted: #93a1af; --acc: #5aa9ff; --ok: #4caf7d;
  --warn: #e0b34d; --pr: #b07cff; --err: #e06c5d;
}
* { box-sizing: border-box; }
/* atrybut hidden musi zawsze wygrywać z regułami display (2026-09-18:
   .head-sub {display:flex} nadpisywał [hidden] — userbox widoczny na splashu) */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.55 system-ui, "Segoe UI", sans-serif;
  touch-action: manipulation; /* brak podwójnego zoomu / opóźnienia tapu */
  overscroll-behavior-y: none;
}
a { color: var(--acc); }

/* ---------- header (sticky, 2 linie, safe-area) ----------
   linia 1: nazwa + wersja | linia 2: "Witaj x@x.x" + Menu + Zainstaluj + Wyloguj */
header {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.head-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.head-top-actions { display: flex; align-items: center; gap: 8px; }
.brand {
  color: var(--fg); text-decoration: none; font-weight: 700; font-size: 17px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.brand .tld { color: var(--muted); font-weight: 400; }
.ver { color: var(--muted); font-size: 11px; font-family: monospace;
  white-space: nowrap; }
.head-sub { display: flex; gap: 8px; align-items: center; min-width: 0; }
.greet {
  font-size: 13px; color: var(--fg); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#btn-menu {
  color: var(--muted); text-decoration: none; font-size: 13px; white-space: nowrap;
  min-height: 40px; display: inline-flex; align-items: center; padding: 0 6px;
}
#btn-menu:hover { color: var(--fg); }
#install-btn, #btn-logout {
  min-height: 40px; padding: 4px 12px; font-size: 13px; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--fg);
}
#btn-logout:active, #install-btn:active { border-color: var(--acc); }

/* ---------- main ---------- */
main {
  max-width: 860px; margin: 0 auto;
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
}
footer {
  color: var(--muted); font-size: 12px; text-align: center;
  padding: 14px 12px calc(14px + env(safe-area-inset-bottom));
}
h1 { font-size: 21px; margin: 14px 0 8px; }
h2 { font-size: 17px; margin: 18px 0 8px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
.muted { color: var(--muted); }

/* ---------- karty ---------- */
.grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; display: block; color: var(--fg); text-decoration: none;
  min-height: 44px;
}
.card:hover { border-color: var(--acc); }
.card .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.card.disabled { color: var(--muted); opacity: .75; }
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  main { padding: 18px; }
  h1 { font-size: 22px; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ---------- flagi (inline SVG) ---------- */
.flag {
  width: 24px; height: 16px; vertical-align: -3px; margin-right: 4px;
  border-radius: 2px; box-shadow: 0 0 0 1px var(--line);
}
h1 .flag { vertical-align: -4px; }

/* ---------- badge ---------- */
.badge {
  display: inline-block; font-size: 11px; font-weight: 600; border-radius: 5px;
  padding: 1px 7px; margin-right: 5px; border: 1px solid var(--line);
  color: var(--muted); background: var(--panel2); vertical-align: middle;
}
.badge.pp { color: var(--ok); border-color: var(--ok); }
.badge.pr { color: var(--pr); border-color: var(--pr); }
.badge.sp { color: var(--warn); border-color: var(--warn); }
.badge.pd { color: var(--ok); }
.badge.platna { color: var(--warn); }
.badge.locked { color: var(--warn); }

/* ---------- bloki treści ---------- */
.focus { background: var(--panel2); border-left: 3px solid var(--pr);
  padding: 10px 12px; border-radius: 6px; margin: 10px 0; }
.hist { background: var(--panel2); border-left: 3px solid var(--acc);
  padding: 10px 12px; border-radius: 6px; margin: 10px 0; }
.ctx { background: var(--panel2); border-left: 3px solid var(--warn);
  padding: 10px 12px; border-radius: 6px; margin: 10px 0; }
/* faza 12h: definicje terminów w przeglądzie epok (polski) */
.era-def { font-size: 0.92em; display: block; margin-top: 2px; }

/* ---------- faza 5: liczniki + info CKE + kalendarz ---------- */
.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.counter {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 6px; text-align: center; min-height: 44px;
}
.counter .num { font-size: 24px; font-weight: 700; color: var(--acc); }
.counter .lbl { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.info-card { margin: 10px 0; }
.info-card .sub { margin-top: 8px; }
/* ---------- dashboard: duże przyciski (mobile-first, tap ≥64 px) ---------- */
/* ---------- nawigacja: "← wstecz" (jeden poziom w górę) ---------- */
.back-link {
  display: inline-flex; align-items: center; min-height: 44px; margin: 4px 0 10px;
  padding: 6px 12px 6px 4px; font-size: 15px; color: var(--muted);
  text-decoration: none; border-radius: 8px;
}
.back-link:active { color: var(--fg); background: var(--panel); }
/* ---------- dashboard: duże przyciski (mobile-first, tap ≥64 px) ---------- */
.dash-nav { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.big-btn {
  display: block; text-decoration: none; color: var(--fg);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; min-height: 64px; font-size: 17px; font-weight: 600;
}
.big-btn:active { border-color: var(--acc); }
.big-btn .sub {
  display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 3px;
}
.info-list { list-style: none; padding: 0; margin: 8px 0; }
.info-list li { border-bottom: 1px solid var(--line); }
.info-list li:last-child { border-bottom: none; }
.info-list a { display: block; padding: 8px 2px; color: var(--fg); text-decoration: none; }
.info-list a:hover { color: var(--acc); }
.info-date { color: var(--muted); font-size: 12px; font-family: monospace; margin-right: 6px; }
.school-text { white-space: pre-line; font-size: 14px; margin: 8px 0; overflow-wrap: anywhere; }
.info-status { font-size: 13px; margin-top: 6px; min-height: 1em; }
.info-status.err { color: var(--err); }
.info-status.ok { color: var(--ok); }

/* ---------- filtry ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.filters select { flex: 1 1 auto; min-width: 0; }
select, button {
  background: var(--panel2); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; font-size: 16px; cursor: pointer;
  min-height: 44px; /* tap target */
}
select { font-size: 15px; }
button { font-size: 15px; }
button.primary { background: var(--acc); border-color: var(--acc); color: #08121e;
  font-weight: 700; }
button:disabled { opacity: .5; cursor: default; }

/* ---------- listy ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li a {
  display: block; padding: 12px 4px; text-decoration: none; color: var(--fg);
  min-height: 44px;
}
.list li a:hover { color: var(--acc); }
.list .t { font-weight: 600; overflow-wrap: anywhere; }
.list .s { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
ul.tight { margin: 6px 0 12px; padding-left: 20px; }
ul.tight li { margin: 3px 0; }
ol.tight { margin: 6px 0 12px; padding-left: 20px; }
ol.tight li { margin: 7px 0; }

/* ---------- tabele ---------- */
table.kv { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.kv td { padding: 5px 8px 5px 0; vertical-align: top; }
table.kv td:first-child {
  color: var(--muted); width: 130px; word-break: break-word;
}
@media (min-width: 640px) {
  table.kv td:first-child { white-space: nowrap; width: 150px; }
}

/* ---------- quiz ---------- */
.quiz-q { background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin: 10px 0; }
.quiz-q .opts label {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: 7px; margin: 6px 0;
  cursor: pointer; border: 1px solid var(--line); min-height: 44px;
}
.quiz-q .opts label:hover { border-color: var(--acc); }
.quiz-q .opts input { margin-top: 3px; }
.quiz-q .correct { border-color: var(--ok); background: rgba(76,175,125,.12); }
.quiz-q .wrong { border-color: var(--err); background: rgba(224,108,93,.12); }
.quiz-q .explain { color: var(--muted); font-size: 13px; margin-top: 6px; }
/* faza 12n: zadania P/F, dopasowanie, tabela (bank CKE pp) */
.quiz-q .pf-row { display: flex; gap: 12px; align-items: flex-start;
  padding: 8px 10px; margin: 6px 0; border: 1px solid var(--line);
  border-radius: 7px; }
.quiz-q .pf-st { flex: 1; }
.quiz-q .pf-opts { display: flex; gap: 10px; white-space: nowrap; }
.quiz-q select { padding: 8px 10px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--panel); color: inherit; }

/* ---------- auth ---------- */
.auth {
  max-width: 420px; margin: 24px auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; padding: 20px 16px;
}
.auth h1 { font-size: 20px; margin: 0 0 4px; }
.auth input {
  width: 100%; background: var(--panel2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-size: 16px; /* ≥16 px = brak auto-zoomu iOS */
  margin: 8px 0;
}
.auth button { width: 100%; margin-top: 10px; padding: 12px; }
.auth .alt { color: var(--muted); font-size: 13px; margin-top: 12px;
  text-align: center; }
.auth .msg { font-size: 14px; margin: 10px 0; min-height: 1.2em;
  overflow-wrap: anywhere; }
.auth .msg.err { color: var(--err); }
.auth .msg.ok { color: var(--ok); }

/* ---------- banner aktualizacji (reguła 20) ---------- */
#update-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--panel2); border-top: 2px solid var(--acc);
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-size: 14px;
}
#update-banner button { min-height: 40px; }
@media (max-width: 480px) {
  #update-banner { flex-direction: column; align-items: stretch; text-align: center; }
  #update-banner button { width: 100%; }
}

.dl { font-size: 12px; font-weight: 600; }
.btn-pack {
  display: inline-block; background: var(--acc); color: #08121e; font-weight: 700;
  border-radius: 8px; padding: 10px 14px; text-decoration: none; min-height: 44px;
  line-height: 1.4;
}

.progress { color: var(--ok); font-weight: 700; }
.progress.no { color: var(--err); }
.lic-warn { background: rgba(224, 179, 77, .14); border: 1px solid var(--warn);
  border-radius: 8px; padding: 8px 10px; margin: 8px 0; color: var(--warn);
  font-weight: 600; }

/* ---------- Cyber-Belfer (agent AI, faza 4) ---------- */
.ai-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.ai-tab { min-height: 40px; padding: 6px 12px; }
.ai-tab.active {
  background: var(--acc); border-color: var(--acc); color: #08121e;
  font-weight: 700;
}
.ai-clear { margin-left: auto; color: var(--muted); font-size: 13px; }
.chat {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; min-height: 280px; max-height: 56vh; overflow-y: auto;
}
.ai-msg { display: flex; margin: 8px 0; }
.ai-msg.user { justify-content: flex-end; }
.ai-bubble {
  max-width: 85%; padding: 9px 12px; border-radius: 10px;
  background: var(--panel2); border: 1px solid var(--line);
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px;
}
.ai-msg.user .ai-bubble { background: rgba(90, 169, 255, .16); border-color: var(--acc); }
.ai-bubble.err { color: var(--err); }
.ai-tool { color: var(--muted); font-size: 12px; margin: 6px 4px; }
/* faza 7e: $$...$$ (display mode) — blok z przewijaniem dla długich wzorów */
.math-display { display: block; margin: 4px 0; overflow-x: auto;
  overflow-y: hidden; }
.ai-empty { padding: 20px 8px; text-align: center; }
.ai-input-row { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.ai-input-row textarea {
  flex: 1; background: var(--panel2); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; font-size: 16px; font-family: inherit;
  resize: none; min-height: 44px; max-height: 120px; line-height: 1.4;
}
.ai-hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.ai-note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
/* faza 7f: panel oceny AI odpowiedzi otwartych (testy / trening / matura) */
.ai-ocena {
  background: var(--panel2); border: 1px solid var(--acc); border-radius: 8px;
  padding: 10px 12px; margin: 10px 0; font-size: 14px; line-height: 1.45;
}
.ai-ocena:empty { display: none; }
.ai-ocena-h { font-weight: 700; margin-bottom: 6px; }
.ai-ocena-body { max-height: 240px; overflow-y: auto; }
.ai-mic { flex: 0 0 auto; background: var(--panel2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; font-size: 16px;
  padding: 8px 10px; cursor: pointer; min-height: 44px; }
.ai-mic.rec { background: var(--err); border-color: var(--err); color: #fff; }
.ocr-panel { background: var(--panel2); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px; margin: 10px 0; }
.ocr-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  font-weight: 600; margin-bottom: 6px; }
.ocr-head button { font-size: 13px; padding: 5px 10px; min-height: 36px; }
.ocr-edit { min-height: 90px; max-height: 240px; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px; white-space: pre-wrap; word-break: break-word; }
.ocr-edit:empty::before { content: attr(data-ph); color: var(--muted); }
.ocr-unc { background: rgba(224, 179, 77, .35); outline: 1px solid var(--warn);
  border-radius: 3px; padding: 0 2px; }

/* ---------- faza 7a: matma — KaTeX + zadania otwarte ---------- */
.katex { font-size: 1.08em; }
.katex-display { margin: 6px 0; overflow-x: auto; overflow-y: hidden; }
.open-ans {
  width: 100%; margin-top: 8px; background: var(--panel2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  font: 15px/1.4 system-ui, "Segoe UI", sans-serif; padding: 10px; resize: vertical;
}
.open-ans:focus { outline: none; border-color: var(--acc); }

/* 12j: kafel poziomu „w przygotowaniu" — wyciszony, ale klikalny */
.card.soon { opacity: .65; }
.card.soon:hover { opacity: 1; }

/* 12i: wskazówki „jak nauczyciel" — przycisk i pudło widoczne na tle
   (raport 2026-09-20: domyślny przycisk ginął, wzory we wskazówkach
   były niewidoczne — brak renderMath po wstawieniu). */
.hint-btn {
  margin-top: 10px; min-height: 44px; padding: 8px 16px;
  background: rgba(224, 179, 77, .12); border: 1px solid rgba(224, 179, 77, .55);
  color: var(--warn); border-radius: 10px; cursor: pointer; font-size: 15px;
}
.hint-btn:hover { background: rgba(224, 179, 77, .22); }
.hints { margin-top: 10px; }
.hint {
  background: rgba(224, 179, 77, .08); border-left: 3px solid var(--warn);
  padding: 8px 12px; margin-top: 8px; border-radius: 0 10px 10px 0;
  font-size: 15px;
}
.hint b { color: var(--warn); }

/* ---------- faza 7b.2: zadania z rozwiązaniami + trening zadaniowy ---------- */
.zad-list { display: grid; gap: 8px; margin: 10px 0 18px; }
.zad { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.zad summary {
  cursor: pointer; padding: 10px 12px; font-size: 15px;
  list-style: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
}
.zad summary::-webkit-details-marker { display: none; }
.zad summary::before { content: "▸ "; color: var(--muted); }
.zad[open] summary::before { content: "▾ "; }
.zad-nr { font-variant-numeric: tabular-nums; }
.zad-body { padding: 6px 14px 12px; border-top: 1px solid var(--line); }
/* faza 12e: akordeon działów — "zadania z rozwiązaniami" (matma pp + pr):
   dział domyślnie zamknięty, klik w nagłówek = rozwijanie */
.dzial { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin: 10px 0; }
.dzial summary {
  cursor: pointer; padding: 10px 12px; font-size: 15px; font-weight: 700;
  list-style: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
}
.dzial summary::-webkit-details-marker { display: none; }
.dzial summary::before { content: "▸ "; color: var(--muted); }
.dzial[open] summary::before { content: "▾ "; }
.dzial[open] summary { border-bottom: 1px solid var(--line); }
.dzial-name { font-size: 1.05em; }
/* faza 12f: 📷 zdjęcie rozwiązania (ocena AI z rękopisu) */
.btn-photo {
  display: inline-flex; align-items: center; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  cursor: pointer; font-size: 15px; line-height: 1;
}
.btn-photo:hover { border-color: var(--muted); }
.btn-photo input { display: none; }
.zad-opts { margin: 10px 0; display: grid; gap: 6px; }
.zad-opt { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.zad-opt.correct { border-color: var(--ok); font-weight: 600; }
/* faza 13a: fizyka PR — obrazki zadań + autoocena zamkniętych w kartach */
.zad-img { max-width: 340px; width: 100%; margin: 4px 10px 4px 0;
  border: 1px solid var(--line); border-radius: 8px; vertical-align: top; }
.zad .opts label.fiz-optl {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: 7px; margin: 6px 0;
  cursor: pointer; border: 1px solid var(--line); min-height: 44px;
}
.zad .opts label.fiz-optl:hover { border-color: var(--acc); }
.zad .opts label.fiz-optl input { margin-top: 3px; }
.zad .opts label.fiz-optl.correct {
  border-color: var(--ok); background: rgba(76,175,125,.12); }
.zad .opts label.fiz-optl.wrong {
  border-color: var(--err); background: rgba(224,108,93,.12); }
.zad .pf-row { display: flex; gap: 12px; align-items: flex-start;
  padding: 8px 10px; margin: 6px 0; border: 1px solid var(--line);
  border-radius: 7px; }
.zad .pf-st { flex: 1; }
.zad .pf-opts { display: flex; gap: 10px; white-space: nowrap; }
.fiz-fb { margin-top: 10px; }
.zad-q { font-size: 16px; margin-bottom: 10px; }
.drill-strip { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 14px; }
.drill-n {
  width: 30px; height: 30px; display: inline-flex; align-items: center;
  justify-content: center; border-radius: 6px; border: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.drill-n.ok { background: var(--ok); border-color: var(--ok); color: #101418; }
.drill-n.help { background: var(--warn); border-color: var(--warn); color: #101418; }
.drill-n.no { background: var(--err); border-color: var(--err); color: #101418; }

/* ---------- teoria (2.20260916.1): 📚 Teoria per zakres ---------- */
.th { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); margin: 8px 0; }
.th summary {
  cursor: pointer; padding: 12px 14px; font-size: 15px; min-height: 44px;
  list-style: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.th summary::-webkit-details-marker { display: none; }
.th summary::before { content: "▸ "; color: var(--muted); }
.th[open] summary::before { content: "▾ "; }
.th summary .t { font-weight: 600; }
.th-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.th-sub { margin-top: 12px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); }
.th-form li { margin: 6px 0; }
.th-d { color: var(--muted); font-size: 13px; margin-left: 6px; }
.th-broz { color: var(--pr); border-color: var(--pr); }
.drill-n.cur { border-color: var(--acc); color: var(--acc); font-weight: 700; }
.drill-opts { display: grid; gap: 6px; margin: 12px 0; }
.drill-opt {
  text-align: left; padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel2);
  color: var(--fg); cursor: pointer; font-size: 14px;
}
.drill-opt:active { border-color: var(--acc); }
.drill-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.drill-actions button, .drill-actions a { min-height: 44px; }
.drill-text {
  width: 100%; min-height: 72px; resize: vertical; margin: 10px 0;
  background: var(--panel2); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: 14px/1.5 system-ui, "Segoe UI", sans-serif;
}
.drill-text:focus { outline: none; border-color: var(--acc); }
.drill-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: 8px 0 2px; }
.drill-bar-i { height: 100%; background: var(--ok); }

/* ---------- faza 7c: matura próbna matmy ---------- */
.mm-zk { display: grid; gap: 6px; margin: 10px 0 18px; }
.mm-zk-row {
  display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px;
  background: var(--panel);
}
.mm-zk-row .t { font-weight: 600; }
.mm-grades { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mm-grade, .mm-grade-on { min-height: 44px; }
.mm-grade-on { font-weight: 700; }
.mm-grade-on.ok { color: var(--ok); }
.mm-grade-on.warn { color: var(--warn); }
.mm-grade-on.no { color: var(--err); }

/* ---------- faza 10a: angielski — konteksty EN (wiązki) + audio ---------- */
.ang-ctx {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 14px; line-height: 1.45;
}
.ang-bundle-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  margin: 14px 0 2px; }
.ang-audio { width: 100%; margin: 6px 0; }
.ang-temat {
  display: block; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin: 8px 0; cursor: pointer; background: var(--panel2);
}
.ang-temat:hover { border-color: var(--acc); }
.ang-temat input { margin-right: 8px; }
.ang-temat .s { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- landing (unauthenticated) — hero + wachlarz ekranów ---------- */
.landing { text-align: center; padding: 22px 4px 48px; overflow-x: clip; }
.landing-login {
  display: inline-block; font-size: 14px; color: var(--muted);
  text-decoration: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 18px; min-height: 40px; line-height: 22px;
}
.landing-login:hover { color: var(--fg); border-color: var(--acc); }
.landing-h1 {
  font-size: clamp(30px, 7vw, 46px); line-height: 1.06; letter-spacing: -0.6px;
  margin: 18px 0 10px;
}
.landing-sub {
  color: var(--muted); font-size: 15px; line-height: 1.55;
  max-width: 560px; margin: 0 auto 22px;
}
.landing-cta {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  margin-bottom: 36px;
}
.landing-cta button.primary {
  border: none; font-size: 16px; font-weight: 700;
  padding: 14px 36px; border-radius: 12px; min-height: 50px;
}
.landing-cta .muted { font-size: 13px; }

/* ekrany apki: mobile = karuzela (scroll-snap, duże ekrany),
   desktop = wachlarz 6 (rotacja + łuk). Telefony w ramce (bezel + wycinek).
   KOLEJNOŚĆ (6): 1 lektury, 2 matma, 3 belfer, 4 matura(HERO), 5 pisanie,
   6 testy — łuk/rozmiar/z-index mapowane wg dystansu od hero (child 4). */
.landing-fan {
  display: flex; align-items: center; gap: 10px;
  overflow-x: auto; overflow-y: visible;
  scroll-snap-type: x mandatory;
  padding: 30px calc(50% - 24vw) 52px;
  scrollbar-width: none;
}
.landing-fan::-webkit-scrollbar { display: none; }
.fan-phone {
  margin: 0; flex: 0 0 auto; scroll-snap-align: center;
  position: relative; padding: 7px; cursor: pointer;
  background: #04060a; border: 2px solid #46525f; border-radius: 26px;
  box-shadow: 0 16px 34px rgba(0,0,0,.55);
}
.fan-phone::after { /* wycinek głośnika */
  content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 30%; height: 5px; border-radius: 3px; background: #222c36; z-index: 2;
  pointer-events: none;
}
.fan-phone img {
  display: block; height: auto; width: 40vw;
  border-radius: 19px; background: #05070a;
}
.fan-phone.hero img { width: 44vw; }
.fan-phone:active { transform: scale(.985); }
.landing-hint {
  color: var(--muted); font-size: 13px; margin: -8px 0 0;
  animation: hint-pulse 2.2s ease-in-out infinite;
}
@keyframes hint-pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@media (min-width: 720px) {
  .landing-fan {
    overflow: visible; scroll-snap-type: none;
    justify-content: center; align-items: flex-end;
    gap: 0; padding: 34px 0 60px;
  }
  .fan-phone {
    margin: 0 -14px; transform-origin: 50% 125%;
    transform: rotate(var(--rot, 0deg));
  }
  .fan-phone img { width: 126px; }
  .fan-phone:nth-child(1) img, .fan-phone:nth-child(2) img,
  .fan-phone:nth-child(6) img { width: 104px; }
  .fan-phone.hero img { width: 156px; }
  .fan-phone:nth-child(3), .fan-phone:nth-child(5) {
    transform: rotate(var(--rot)) translateY(12px); z-index: 2;
  }
  .fan-phone:nth-child(2), .fan-phone:nth-child(6) {
    transform: rotate(var(--rot)) translateY(26px); z-index: 1;
  }
  .fan-phone:nth-child(1) {
    transform: rotate(var(--rot)) translateY(32px); z-index: 1;
  }
  .fan-phone.hero { z-index: 3; }
}
@media (min-width: 720px) and (hover:hover) {
  .fan-phone { transition: transform .22s ease, box-shadow .22s ease; }
  .fan-phone:hover { transform: rotate(var(--rot)) translateY(-8px); z-index: 6;
    box-shadow: 0 26px 54px rgba(0,0,0,.7); }
}

/* ---------- lightbox: powiększony ekran + dymki komiksowe ---------- */
#lb { position: fixed; inset: 0; z-index: 60; }
#lb[hidden] { display: none; }
#lb.open { display: block; }
.lb-backdrop {
  position: absolute; inset: 0; background: rgba(4,7,11,.84);
  backdrop-filter: blur(4px);
}
.lb-stage {
  position: absolute; left: 50%; top: 50%;
  width: min(92vw, 40vh);
  transform: translate(-50%, -50%);
}
.lb-stage img {
  width: 100%; display: block; border-radius: 22px;
  border: 3px solid #05070a; box-shadow: 0 30px 80px rgba(0,0,0,.75);
}
.lb-close {
  position: fixed; top: 14px; right: 14px; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.lb-close:active { border-color: var(--acc); }
/* dymka: biała „komiksowa" z ogonkiem; pozycja = kotwica na zrzucie (%),
   a = wyrównanie (center/left/right), d = strona (up/down) */
.dymka { position: absolute; z-index: 3; max-width: 52%; }
.dymka span {
  display: block; position: relative;
  background: #f7f9fb; color: #0c1116; border: 2px solid #0c1116;
  border-radius: 12px; padding: 6px 9px;
  font-size: 12px; line-height: 1.35; font-weight: 600;
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
  opacity: 0; transform: scale(.4); transform-origin: bottom center;
  animation: dymka-in .3s cubic-bezier(.34,1.56,.64,1) forwards;
  animation-delay: var(--d, .15s);
}
.dymka.up span { transform-origin: bottom center; }
.dymka.down span { transform-origin: top center; }
.dymka::after { /* ogonek */
  content: ""; position: absolute; width: 12px; height: 12px;
  background: #f7f9fb; border: 2px solid #0c1116;
  border-top: none; border-left: none;
  opacity: 0;
  animation: dymka-tail-up .3s cubic-bezier(.34,1.56,.64,1) forwards;
  animation-delay: var(--d, .15s);
}
.dymka.up { transform: translate(-50%, calc(-100% - 8px)); }
.dymka.up.left { transform: translate(0, calc(-100% - 8px)); }
.dymka.up.right { transform: translate(-100%, calc(-100% - 8px)); }
.dymka.up::after { bottom: -7px; left: calc(50% - 6px); }
.dymka.up.left::after { left: calc(15% - 6px); }
.dymka.up.right::after { left: calc(85% - 6px); }
.dymka.down { transform: translate(-50%, 8px); }
.dymka.down.left { transform: translate(0, 8px); }
.dymka.down.right { transform: translate(-100%, 8px); }
.dymka.down::after {
  top: -7px; bottom: auto; left: calc(50% - 6px);
  transform: rotate(225deg);
}
.dymka.down.left::after { left: calc(15% - 6px); }
.dymka.down.right::after { left: calc(85% - 6px); }
.dymka:nth-child(1) { --d: .15s; }
.dymka:nth-child(2) { --d: .35s; }
.dymka:nth-child(3) { --d: .55s; }
.dymka:nth-child(4) { --d: .75s; }
.dymka:nth-child(5) { --d: .95s; }
@keyframes dymka-in {
  from { opacity: 0; transform: scale(.4); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes dymka-tail-up {
  from { opacity: 0; transform: rotate(45deg) scale(.4); }
  to { opacity: 1; transform: rotate(45deg) scale(1); }
}
@keyframes dymka-tail-down {
  from { opacity: 0; transform: rotate(225deg) scale(.4); }
  to { opacity: 1; transform: rotate(225deg) scale(1); }
}
.dymka.down::after { animation-name: dymka-tail-down; }
