/* Powłoka aplikacji: pasek, ekran główny, logowanie, ustawienia. Kolory i kroje z kurs.css (tokeny :root). */
html, body { margin: 0; }
[hidden] { display: none !important; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#app { flex: 1; display: flex; flex-direction: column; }
.loading { padding: 40px 16px; color: var(--muted); text-align: center; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }

.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line); padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.brand { display: flex; align-items: baseline; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand .eyebrow { font-size: 11px; }
.brand-name { font-family: var(--font-display); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 479px) { .brand-name { white-space: normal; line-height: 1.12; font-size: 17px; } }
.brand .back { font-size: 18px; }
.bar-r { display: flex; gap: 8px; align-items: center; flex: none; }
@media (max-width: 479px) { .brand .eyebrow { display: none; } }
@media (max-width: 359px) { .brand-name { font-size: 16px; } .quick-exit { padding: 6px 10px; font-size: 13px; } }
@media (max-width: 329px) { .brand .back { display: none; } .brand-name { font-size: 15px; } .quick-exit { padding: 6px 8px; font-size: 12px; } .bar-r { gap: 4px; } }
.narrow > .btn, .narrow form > .btn { justify-self: start; }
@media (max-width: 479px) { .narrow > .btn, .narrow form > .btn { justify-self: stretch; } }

.screen { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding-block: 24px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.screen > .page { padding: 0; }
.narrow { max-width: 620px; display: grid; gap: 14px; }
.narrow > * { margin: 0; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line);
  padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.toast { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 58px); z-index: 4; margin: 10px auto 0; max-width: 620px; width: calc(100% - 32px);
  background: var(--fg); color: var(--bg); border-radius: 10px; padding: 10px 14px; font-size: 15px; }

.err { color: #B2402A; min-height: 0; margin: 0; }
:root[data-theme="dark"] .err { color: var(--coral); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .err { color: var(--coral); } }
.err:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--mustard); flex: none; }
.code-in { font-size: 22px !important; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.field select.sel, .field input[type="email"] { width: 100%; }

.recovery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.recovery span { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: clamp(15px, 4.6vw, 22px); text-align: center; letter-spacing: .06em; user-select: all; }
@media (max-width: 320px) { .recovery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.sec { font-family: var(--font-display); font-weight: 500; font-size: 22px; margin: 30px 0 10px; }
.narrow .sec { margin: 18px 0 0; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: grid; gap: 8px; margin-top: 16px; max-width: 720px; }
.pcard > * { margin: 0; }
.pcard.on { border-color: var(--sage); background: var(--sage-soft); }
.pcard .lbl, .lbl { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.pcard .big { font-family: var(--font-display); font-size: 22px; }
.pause-note { background: var(--surface); border-radius: 10px; padding: 10px 12px; font-size: 15px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line); margin-right: 8px; vertical-align: 1px; }
.dot.on { background: #4E8B5F; }
.codebox .code { overflow-wrap: anywhere; }

.mods { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 720px; }
.mods li { display: grid; gap: 6px; }
.mod { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 2px 14px; align-items: baseline; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.mod:hover { border-color: var(--fg); }
.mn { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--mustard-ink); }
.mt { font-family: var(--font-display); font-size: 19px; line-height: 1.25; }
.mp { grid-column: 2; display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.mp .track { flex: 1; max-width: 220px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.mp .track i { display: block; height: 100%; background: var(--mustard); }
.parts { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 16px; }
.part { font-size: 14px; color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; min-height: 40px; box-sizing: border-box; display: inline-flex; align-items: center; text-decoration: none; }
.parts { align-items: center; }
.parts-l { font-size: 13px; color: var(--muted); width: 100%; }
.locked .mod, .part.locked { opacity: .5; }
@media (max-width: 480px) { .mod { grid-template-columns: 1fr; } .mp { grid-column: 1; } }
/* moduł z częściami (osobne lekcje): przyciski części w tej samej karcie, pod paskiem postępu */
.mods li.withparts { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.mods li.withparts:has(> .mod:hover) { border-color: var(--fg); }
.mods li.withparts .mod { border: 0; background: none; padding-bottom: 10px; }
.mods li.withparts .parts { padding: 10px 16px 14px 122px; margin: 0 16px 0 0; border-top: 1px dashed var(--line); margin-left: 122px; padding-left: 0; }
@media (max-width: 480px) { .mods li.withparts .parts { margin-left: 16px; } }
.tools { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); max-width: 720px; }
.tool { display: grid; gap: 2px; text-decoration: none; color: inherit; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tool strong { font-family: var(--font-display); font-weight: 500; font-size: 19px; }
a.btn { text-decoration: none; }

.share-box { background: var(--sage-soft); border-radius: 12px; padding: 14px 16px; display: grid; gap: 8px; margin-top: 14px; }
.share-box > * { margin: 0 !important; }
.wait { color: var(--muted); font-style: italic; }

/* Wstawki wideo na ekranie głównym */
.vslot { max-width: 720px; margin-top: 14px; display: grid; gap: 6px; }
.vslot .vid { width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background: #252A28; }
.vslot .vid-empty .t { font-weight: 600; }
.vslot details.script { margin: 0; }

/* Plansza tytułowa: na grafitowym tle, jak znak TAK O NAS */
.splash { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; overflow-y: auto;
  background: #252A28; color: #F7F2E8; text-align: center; transition: opacity .35s ease;
  padding-block: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.splash.out { opacity: 0; }
.sp-in { display: grid; justify-items: center; gap: 14px; max-width: 520px; width: 100%; }
.sp-znak { position: relative; width: min(56vw, 240px, 32vh); aspect-ratio: 1; }
.sp-znak img { position: absolute; inset: 0; width: 100%; height: 100%; }
.sp-l { clip-path: inset(0 67% 0 0); animation: sp-l 1.6s cubic-bezier(.2,.7,.2,1) both; }
.sp-r { clip-path: inset(0 0 0 69%); animation: sp-r 1.6s cubic-bezier(.2,.7,.2,1) both; }
.sp-c { clip-path: inset(0 31% 0 33%); transform-origin: 50% 52%; animation: sp-c 1.5s .9s cubic-bezier(.3,.8,.3,1) both; }
/* po złożeniu: cały znak bez szwów (kształt logo bez zmian), dalej tylko oddech całości */
.sp-l, .sp-r, .sp-c { animation-fill-mode: both; }
.sp-znak .sp-full { opacity: 0; animation: sp-pelny .4s 2.35s both; }
.sp-znak:has(.sp-full) .sp-l, .sp-znak:has(.sp-full) .sp-r, .sp-znak:has(.sp-full) .sp-c { transition: opacity .3s; }
.sp-znak { animation: sp-oddech 6s 2.8s ease-in-out infinite alternate; }
@keyframes sp-pelny { from { opacity: 0; } to { opacity: 1; } }
@keyframes sp-l { from { opacity: 0; transform: translateX(-38%); } to { opacity: 1; transform: none; } }
@keyframes sp-r { from { opacity: 0; transform: translateX(38%); } to { opacity: 1; transform: none; } }
@keyframes sp-c { from { opacity: 0; transform: rotate(-120deg) scale(.35); } to { opacity: 1; transform: none; } }
@keyframes sp-oddech { from { transform: scale(1); } to { transform: scale(1.035); } }
@keyframes sp-schowaj { to { opacity: 0; } }
.sp-l, .sp-r { animation: sp-l 1.6s cubic-bezier(.2,.7,.2,1) both, sp-schowaj .1s 2.75s forwards; }
.sp-r { animation-name: sp-r, sp-schowaj; }
.sp-c { animation: sp-c 1.5s .9s cubic-bezier(.3,.8,.3,1) both, sp-schowaj .1s 2.75s forwards; }
.sp-logo { width: min(62vw, 260px); height: auto; margin-top: 6px; animation: sp-tekst .8s 1.9s both; }
.sp-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 8vw, 46px); line-height: 1.1; margin: 4px 0 0; animation: sp-tekst .8s 2.2s both; }
.sp-sub { margin: 0; color: #CFC7B8; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; animation: sp-tekst .8s 2.4s both; }
.splash .sp-go { background: #F7F2E8; color: #252A28; border-color: #F7F2E8; min-width: 160px; margin-top: 10px; animation: sp-tekst .8s 2.6s both; }
.sp-author { margin: 6px 0 0; font-size: 14px; color: #CFC7B8; animation: sp-tekst .8s 2.6s both; }
.sp-author a { color: #F7F2E8; }
@keyframes sp-tekst { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .splash *, .splash { animation: none !important; transition: none !important; } }
.foot a { color: inherit; }

/* Ekran główny: „Dalej w kursie”, podtytuły modułów */
.go-card { background: var(--fg); color: var(--bg); border-radius: 14px; padding: 18px; display: grid; gap: 8px; margin-top: 14px; max-width: 720px; justify-items: start; }
.go-card .lbl { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.go-card p { margin: 0; } .go-card .big { font-family: var(--font-display); font-size: 21px; }
.go-card .btn { background: var(--bg); color: var(--fg); border-color: var(--bg); }
.mt .ms { display: block; font-family: var(--font-body); font-size: 14px; color: var(--muted); margin-top: 2px; }
/* Zapis i podpowiedź o szybkim wyjściu */
.saved { font-size: 13px; color: var(--muted); white-space: nowrap; }
.saved.ok { color: #4E8B5F; }
.exit-tip { margin: 10px auto 0; max-width: 720px; width: calc(100% - 32px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; justify-items: start; font-size: 15px; }
.exit-tip p { margin: 0; }
@media (max-width: 400px) { .saved { display: none; } .saved.ok, .saved:not(:empty) { display: inline; font-size: 12px; } }

/* Pasek „gdzie jestem” w nagłówku kursu */
.bar:has(.where) { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; }
.bar:has(.where) .where { grid-column: 1 / -1; }
.bar-r .saved { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 400px) { .bar-r .saved { max-width: 70px; } }
.where { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding-top: 6px; margin-top: 8px; border-top: 1px solid var(--line); min-width: 0; }
.wmap { display: flex; gap: 4px; flex: none; align-items: center; }
.wm-l { font-size: 12px; color: var(--muted); margin-right: 4px; }
.wm { min-width: 32px; height: 32px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line); display: inline-grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; background: var(--surface); }
.wm.done { color: var(--fg); border-color: var(--sage); background: var(--sage-soft); }
.wm.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.wm.locked { opacity: .45; }
.wlabel { font-size: 13px; line-height: 1.35; color: var(--muted); min-width: 0; flex: 1 1 200px; }
.wlabel b { color: var(--fg); }
@media (max-width: 359px) { .wm { min-width: 30px; height: 30px; padding: 0 4px; font-size: 11px; } .wmap { gap: 3px; } .wm-l { display: none; } }
@media (max-width: 299px) { .bar-r .saved { display: none !important; } }

/* Ścieżka kursu: plansza wyboru, karta „w pojedynkę” na ekranie głównym */
.path-choice { margin-top: 4px; }
.path-choice .opt { padding: 18px; }
.path-choice .opt strong { font-size: 21px; line-height: 1.25; }
.path-choice .opt span { font-size: 16px; }
.path-solo { max-width: 720px; }
.go-card .row { gap: 6px 18px; }
.go-card .btn.link { background: none; border: none; color: var(--bg); }
