:root {
  --bg: #0f1512;
  --panel: #161e1a;
  --panel2: #1d2722;
  --line: #2a3630;
  --text: #e8efe9;
  --muted: #8fa198;
  --green: #1fbf6a;
  --green-d: #17994f;
  --red: #e5484d;
  --amber: #f5a524;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }

.top { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); z-index: 5; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 18px; }
.logo img { width: 28px; height: 28px; }
.logo b { color: var(--green); }
.topinfo { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

main { max-width: 860px; margin: 0 auto; padding: 20px 16px 110px; }

/* Start */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(28px, 6vw, 44px); line-height: 1.1; margin: 0 0 10px; }
.hero h1 span { color: var(--green); }
.hero p { color: var(--muted); margin: 0; max-width: 560px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 24px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; text-align: left; color: var(--text); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--green); transform: translateY(-2px); }
.tile h3 { margin: 0 0 4px; font-size: 18px; }
.tile p { margin: 0; color: var(--muted); font-size: 14px; }
.tile.main { background: linear-gradient(135deg, var(--green-d), var(--green)); border: none; color: #06110b; }
.tile.main p { color: #0b2a18; }
.tile[disabled] { opacity: .45; pointer-events: none; }
.stats { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 22px; color: var(--muted); font-size: 14px; }
.stats b { color: var(--text); font-size: 20px; display: block; }

/* Pytanie */
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  color: var(--muted); font-size: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.pill { background: var(--panel2); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; }
.progress { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.progress i { display: block; height: 100%; background: var(--green); transition: width .3s; }
.timer { height: 4px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin: 10px 0 0; }
.timer i { display: block; height: 100%; background: var(--amber); }

.media { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9;
  display: grid; place-items: center; margin-bottom: 16px; border: 1px solid var(--line); }
.media img, .media video { width: 100%; height: 100%; object-fit: contain; }
.media .brak { color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.q { font-size: clamp(18px, 3.4vw, 22px); font-weight: 600; margin: 0 0 18px; }

.answers { display: grid; gap: 10px; }
.answers.tn { grid-template-columns: 1fr 1fr; }
.ans { background: var(--panel); border: 2px solid var(--line); color: var(--text); border-radius: 12px;
  padding: 14px 16px; text-align: left; display: flex; gap: 12px; align-items: flex-start; }
.answers.tn .ans { justify-content: center; font-weight: 700; font-size: 18px; }
.ans .k { font-weight: 700; color: var(--muted); min-width: 18px; }
.ans:hover:not([disabled]) { border-color: var(--muted); }
.ans.sel { border-color: var(--green); background: color-mix(in srgb, var(--green) 12%, var(--panel)); }
.ans.ok { border-color: var(--green); background: color-mix(in srgb, var(--green) 18%, var(--panel)); }
.ans.zle { border-color: var(--red); background: color-mix(in srgb, var(--red) 16%, var(--panel)); }
.ans[disabled] { cursor: default; }

.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.btn { background: var(--green); color: #06110b; border: none; border-radius: 10px; padding: 12px 20px; font-weight: 700; }
.btn:hover { background: #29d77b; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.feedback { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-weight: 600; }
.feedback.ok { background: color-mix(in srgb, var(--green) 15%, transparent); color: #6ee7a4; }
.feedback.zle { background: color-mix(in srgb, var(--red) 15%, transparent); color: #ff8b8f; }

/* Wynik */
.wynik { text-align: center; padding: 30px 0; }
.wynik .big { font-size: 64px; font-weight: 800; line-height: 1; }
.wynik.zdany .big { color: var(--green); }
.wynik.oblany .big { color: var(--red); }
.lista { display: grid; gap: 8px; margin-top: 20px; }
.lista .row { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--green);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; display: flex; justify-content: space-between; gap: 12px; }
.lista .row.zle { border-left-color: var(--red); }
.lista .row span:last-child { color: var(--muted); white-space: nowrap; }

@media (max-width: 520px) {
  .answers.tn { grid-template-columns: 1fr 1fr; }
  .actions .btn { flex: 1; }
}

/* Wybór kategorii */
.kat-label { margin-top: 22px; color: var(--muted); font-size: 14px; }
.kat-label b { color: var(--green); }
.kats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.kat { min-width: 48px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-weight: 700; }
.kat:hover { border-color: var(--muted); }
.kat.on { background: var(--green); border-color: var(--green); color: #06110b; }

/* AI instruktor: kółko z robotem + panel */
.robot { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  width: 60px; height: 60px; border-radius: 50%; border: none; z-index: 20;
  background: var(--green); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.45), 0 0 0 4px color-mix(in srgb, var(--green) 25%, transparent); }
.robot:hover { background: #29d77b; }
.robot[hidden] { display: none; }
.robot svg { color: #fff; }
.robot.pop { animation: pop .35s cubic-bezier(.3,1.6,.6,1); }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }

.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 30; }
.sheet-bg[hidden], .sheet[hidden] { display: none; }
.sheet { position: fixed; z-index: 31; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100%); max-height: 80vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-bottom: none; border-radius: 18px 18px 0 0;
  padding: 16px 16px max(16px, env(safe-area-inset-bottom)); animation: wjazd .25s ease-out; }
@keyframes wjazd { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@media (min-width: 700px) { .sheet { left: auto; right: 24px; bottom: 96px; transform: none; border-radius: 18px;
  border-bottom: 1px solid var(--line); width: 420px; animation: wjazd2 .2s ease-out; } }
@keyframes wjazd2 { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-ico { width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; }
.sheet-ico svg { width: 20px; height: 20px; }
.sheet-x { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 26px; line-height: 1; padding: 0 4px; }
.sheet-txt { font-size: 15px; line-height: 1.6; }
.sheet-txt b { color: var(--green); }
.sheet-txt.pisze:empty::before { content: "Instruktor myśli…"; color: var(--muted); }
.sheet-txt.pisze::after { content: "▍"; color: var(--green); animation: mig 1s steps(2) infinite; }
@keyframes mig { 50% { opacity: 0; } }
.sheet-sep { margin: 14px 0 6px; font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions .btn[hidden] { display: none; }
.lista .row[data-id] { cursor: pointer; }
.lista .row[data-id]:hover { border-color: var(--muted); }
.zapamietaj { display: block; margin-top: 10px; padding: 8px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--green) 14%, transparent); border-left: 3px solid var(--green); }
.zapamietaj b { color: var(--green); }

/* Info o filmie w fazie zapoznania się z pytaniem (egzamin) */
.media { position: relative; }
.media-info { position: absolute; inset: auto 12px 12px 12px; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 14px; border: none; border-radius: 10px; background: rgba(0,0,0,.72); color: #fff; font-size: 14px; backdrop-filter: blur(4px); }
.media-info b { color: var(--green); font-variant-numeric: tabular-nums; }
.media-info .play { width: 0; height: 0; border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.media-info:hover { background: rgba(0,0,0,.85); }

/* iPhone: miejsce na pasek statusu/notch w trybie apki z ekranu początkowego */
.top { padding-top: max(14px, env(safe-area-inset-top)); }
