/* TALKO — wygląd aplikacji. Mobile-first, max 520 px szerokości; na komputerze wyśrodkowana „karta telefonu”. */

:root {
  --teal: #12B5A5; --teal-d: #0B8A7E; --teal-t: #E3F7F4;
  --coral: #FF6B57; --coral-d: #D4473A;
  --navy: #1B2540; --navy-2: #33405F;
  --gold: #FFC531; --gold-d: #E0A100;
  --ok: #2BB673; --ok-d: #1E9159; --ok-t: #E2F8EA;
  --no: #F2545B; --no-d: #C93A41; --no-t: #FFE8E8;
  --soft: #F29A1B; --soft-t: #FFF3DC;
  --bg: #F5F7FB; --card: #FFFFFF; --line: #E4E8F0; --line-d: #CDD4E0;
  --text: #1B2540; --muted: #6B7488;
  --shadow: 0 1px 2px rgba(27, 37, 64, .06), 0 8px 24px rgba(27, 37, 64, .06);
  --r: 18px;
  --u: var(--teal); --u-shade: var(--teal-d); --u-tint: var(--teal-t);
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827; --card: #1A2335; --line: #2A3550; --line-d: #3A4766;
    --text: #EEF2FA; --muted: #9AA6BF; --navy-2: #C9D3E8;
    --teal-t: #123A3A; --ok-t: #133A29; --no-t: #43222A; --soft-t: #3E2F12;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  min-height: 100dvh; overscroll-behavior-y: none;
}
@media (min-width: 560px) {
  body { background: radial-gradient(1200px 600px at 50% -10%, #DDF5F2 0%, var(--bg) 60%); }
}
@media (min-width: 560px) and (prefers-color-scheme: dark) {
  body { background: radial-gradient(1200px 600px at 50% -10%, #17333A 0%, var(--bg) 60%); }
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
b, strong { font-weight: 800; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 900; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.center { text-align: center; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------------- przyciski 3D (jak w Duolingo, tylko gładsze) ---------------- */

.btn {
  --c: var(--teal); --cd: var(--teal-d);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 16px; padding: 13px 20px; min-height: 50px;
  font-weight: 900; font-size: 15px; letter-spacing: .06em; text-transform: uppercase;
  background: var(--c); color: #fff; box-shadow: 0 4px 0 var(--cd);
  transition: transform .08s, box-shadow .08s, filter .15s; width: 100%;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--cd); }
.btn:hover:not(:disabled) { filter: brightness(1.04); }
.btn:disabled { --c: var(--line); --cd: var(--line-d); color: var(--muted); cursor: default; }
.btn-lg { min-height: 56px; font-size: 16px; }
.btn-ok { --c: var(--ok); --cd: var(--ok-d); }
.btn-no { --c: var(--no); --cd: var(--no-d); }
.btn-soft { --c: var(--soft); --cd: #C77F06; }
.btn-danger { --c: var(--no); --cd: var(--no-d); }
.btn-unit { --c: var(--u); --cd: var(--u-shade); }
.btn-ghost { background: var(--card); color: var(--teal-d); box-shadow: 0 0 0 2px var(--line) inset, 0 4px 0 var(--line); }
.btn-ghost:active:not(:disabled) { box-shadow: 0 0 0 2px var(--line) inset, 0 0 0 var(--line); }
@media (prefers-color-scheme: dark) { .btn-ghost { color: #5FE0D2; } }
.btn-small { width: auto; min-height: 40px; padding: 8px 14px; font-size: 18px; }
.icon-btn { background: none; border: 0; font-size: 22px; color: var(--muted); padding: 8px; line-height: 1; font-weight: 900; }
.link { background: none; border: 0; color: var(--teal-d); font-weight: 800; padding: 6px; }
@media (prefers-color-scheme: dark) { .link { color: #5FE0D2; } }

/* ---------------- Tiko ---------------- */

.tiko { display: block; overflow: visible; }
.tiko .tk-eyes { transform-origin: 100px 90px; animation: blink 4.5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.tiko .tk-tail { transform-origin: 132px 160px; animation: tail 2.8s ease-in-out infinite; }
@keyframes tail { 50% { transform: rotate(-7deg); } }
.tiko .tk-wave { transform-origin: 140px 152px; animation: wave 1.2s ease-in-out infinite; }
@keyframes wave { 50% { transform: rotate(-22deg); } }
.tiko--cheer { animation: hop .9s ease-in-out infinite; }
@keyframes hop { 50% { transform: translateY(-8px); } }
.tiko .tk-spark { animation: spark 1.2s ease-in-out infinite alternate; transform-origin: center; }
@keyframes spark { to { opacity: .35; } }

.bubble { position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px 16px; }
.bubble-tiko { font-weight: 700; }
.bubble-tiko .kicker, .kicker { display: block; font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--teal-d); margin-bottom: 2px; }
@media (prefers-color-scheme: dark) { .kicker, .bubble-tiko .kicker { color: #5FE0D2; } }
.tiko-says { display: flex; align-items: flex-end; gap: 6px; margin-bottom: 18px; }
.tiko-says .tiko { flex: none; }
.tiko-says .bubble { flex: 1; margin-bottom: 14px; }
.tiko-says .bubble::before {
  content: ''; position: absolute; left: -9px; bottom: 16px; width: 14px; height: 14px; background: var(--card);
  border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg);
}

/* ---------------- ekran powitalny ---------------- */

.welcome { align-items: center; justify-content: center; text-align: center; padding: calc(28px + var(--safe-t)) 24px calc(24px + var(--safe-b)); position: relative; overflow: hidden; }
.welcome-glow { position: absolute; inset: -20% -40% auto; height: 70%; background: radial-gradient(closest-side, rgba(18, 181, 165, .22), transparent), radial-gradient(closest-side at 70% 60%, rgba(255, 107, 87, .16), transparent); pointer-events: none; }
.welcome-hero { position: relative; display: flex; flex-direction: column; align-items: center; }
.welcome-hero .speech {
  position: relative; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px 16px;
  font-weight: 700; max-width: 300px; margin-top: 8px; box-shadow: var(--shadow);
}
.welcome-hero .speech::before { content: ''; position: absolute; top: -9px; left: 50%; width: 14px; height: 14px; background: var(--card); border-left: 2px solid var(--line); border-top: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }
.wordmark {
  font-size: 56px; font-weight: 900; letter-spacing: .02em; margin-top: 22px;
  background: linear-gradient(90deg, var(--teal), #3CC9A0 45%, var(--coral)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { font-size: 18px; font-weight: 800; color: var(--muted); margin: 4px 0 30px; }
.welcome-actions { display: grid; gap: 14px; width: 100%; max-width: 360px; }

/* ---------------- onboarding / lekcja: wspólny układ ---------------- */

.lesson-top { display: flex; align-items: center; gap: 12px; padding: calc(12px + var(--safe-t)) 16px 8px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.bar { flex: 1; height: 16px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ok); border-radius: 99px; transition: width .45s cubic-bezier(.3, 1.4, .5, 1); position: relative; min-width: 16px; }
.lesson .bar-fill { background: var(--u); }
.bar-fill i { position: absolute; left: 8px; right: 8px; top: 4px; height: 4px; border-radius: 9px; background: rgba(255, 255, 255, .35); }
.combo { font-weight: 900; color: var(--coral); font-size: 14px; white-space: nowrap; }
.combo.pop { animation: pop .4s ease; }
@keyframes pop { 40% { transform: scale(1.35); } }

.lesson-body, .onboard-body { flex: 1; padding: 14px 18px 24px; overflow-y: auto; }
.lesson-foot { position: sticky; bottom: 0; background: var(--bg); border-top: 2px solid var(--line); padding: 14px 18px calc(16px + var(--safe-b)); z-index: 5; transition: background .2s; }
.lesson-foot.foot-hidden { display: none; }
.foot-row { display: flex; gap: 12px; }
.lesson-foot.is-ok { background: var(--ok-t); border-color: transparent; }
.lesson-foot.is-no { background: var(--no-t); border-color: transparent; }
.lesson-foot.is-soft { background: var(--soft-t); border-color: transparent; }

.fb { margin-bottom: 14px; animation: slideUp .25s ease; }
@keyframes slideUp { from { transform: translateY(14px); opacity: 0; } }
.fb-head { display: flex; align-items: center; gap: 10px; font-size: 21px; }
.fb-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 18px; font-weight: 900; flex: none; }
.is-ok .fb-head { color: var(--ok-d); } .is-ok .fb-ic { background: var(--ok); }
.is-no .fb-head { color: var(--no-d); } .is-no .fb-ic { background: var(--no); }
.is-soft .fb-head { color: #B86E00; } .is-soft .fb-ic { background: var(--soft); }
@media (prefers-color-scheme: dark) { .is-ok .fb-head { color: #5BDB98; } .is-no .fb-head { color: #FF8C91; } .is-soft .fb-head { color: #FFC266; } }
.fb-correct { margin-top: 8px; font-weight: 700; }
.fb-correct span { display: block; font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; opacity: .75; }
.fb-why { margin: 6px 0 0; color: var(--navy-2); }

.prompt { font-size: 22px; margin: 6px 0 18px; }
.prompt-sm { font-size: 18px; margin-top: 18px; }
.gone { display: none !important; }
.retry-chip { display: inline-block; font-size: 13px; font-weight: 800; color: #B86E00; background: var(--soft-t); padding: 4px 10px; border-radius: 99px; margin-bottom: 10px; }
.step.enter { animation: stepIn .3s ease; }
@keyframes stepIn { from { opacity: 0; transform: translateX(18px); } }

/* opcje */
.opts { display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px;
  box-shadow: 0 3px 0 var(--line); font-weight: 700; transition: transform .08s, border-color .15s, background .15s;
}
.opt:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt-key { flex: none; width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; color: var(--muted); font-weight: 900; }
.opt-emo { font-size: 26px; flex: none; }
.opt-txt { flex: 1; }
.opt.sel { border-color: var(--teal); background: var(--teal-t); box-shadow: 0 3px 0 var(--teal); }
.opt.sel .opt-key { border-color: var(--teal); color: var(--teal-d); }
.lesson .opt.sel { border-color: var(--u); background: var(--u-tint); box-shadow: 0 3px 0 var(--u); }
@media (prefers-color-scheme: dark) { .lesson .opt.sel { background: rgba(255, 255, 255, .06); } }
.opts.locked .opt { pointer-events: none; }
.opt.right { border-color: var(--ok) !important; background: var(--ok-t) !important; box-shadow: 0 3px 0 var(--ok) !important; }
.opt.wrong { border-color: var(--no) !important; background: var(--no-t) !important; box-shadow: 0 3px 0 var(--no) !important; animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.opts-styles { grid-template-columns: repeat(3, 1fr); }
.opts-styles .opt { flex-direction: column; text-align: center; gap: 4px; padding: 14px 6px; font-size: 15px; }
.opts-styles .opt-key { display: none; }
.st-ic { font-size: 30px; display: block; margin-bottom: 2px; }
.opts-tf { grid-template-columns: 1fr 1fr; }
.opts-tf .opt { justify-content: center; font-size: 18px; padding: 18px 10px; }
.opts-tf .opt-key { display: none; }

.quote { background: var(--card); border: 2px solid var(--line); border-left: 6px solid var(--u); border-radius: 16px; padding: 18px; font-size: 19px; font-weight: 800; margin-bottom: 20px; }
.quote-situation { font-size: 16px; font-weight: 700; }

/* karta wiedzy */
.learn-card { font-size: 17px; }
.learn-card p { margin: 0; }
.ex { display: grid; gap: 10px; margin-top: 16px; }
.ex-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; font-weight: 700; }
.ex-ic { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: grid; place-items: center; flex: none; font-size: 13px; font-weight: 900; margin-top: 1px; }
.ex-bad { background: var(--no-t); } .ex-bad .ex-ic { background: var(--no); }
.ex-good { background: var(--ok-t); } .ex-good .ex-ic { background: var(--ok); }

.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 16px; }

/* scenka */
.setting { display: inline-block; font-size: 13px; font-weight: 800; color: var(--muted); background: var(--card); border: 2px solid var(--line); padding: 4px 12px; border-radius: 99px; margin-bottom: 14px; }
.chat { display: grid; gap: 12px; }
.msg { display: flex; gap: 10px; align-items: flex-end; }
.msg-me { justify-content: flex-end; }
.ava { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; flex: none; box-shadow: 0 2px 0 rgba(0, 0, 0, .06); }
.msg-body { max-width: 82%; }
.who { font-size: 13px; font-weight: 900; margin: 0 0 4px 4px; }
.who span { font-weight: 700; color: var(--muted); }
.bubble-them { border-bottom-left-radius: 6px; font-weight: 700; font-size: 17px; animation: bubbleIn .3s ease; }
.bubble-me { max-width: 85%; border: 0; color: #fff; background: var(--u); border-bottom-right-radius: 6px; font-weight: 700; animation: bubbleIn .3s ease; }
.bubble-me.no { background: var(--navy-2); }
@media (prefers-color-scheme: dark) { .bubble-me.no { background: #3A4766; } }
@keyframes bubbleIn { from { transform: scale(.85); opacity: 0; } }
.style-tag { display: block; margin-top: 6px; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.typing .txt { display: none; }
.dots { display: none; gap: 4px; padding: 4px 2px; }
.typing .dots { display: inline-flex; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 50% { transform: translateY(-4px); opacity: .5; } }
.opts-reply .opt { border-radius: 18px 18px 6px 18px; }
.opts-reply .opt-key { border-radius: 50%; }

/* układanie zdań */
.tiko-mini { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tiko-mini .bubble { padding: 8px 12px; font-size: 14px; }
.build-line {
  min-height: 112px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; padding: 12px 0;
  background-image: linear-gradient(var(--line) 2px, transparent 2px); background-size: 100% 56px; background-position: 0 50px;
  margin-bottom: 22px; border-radius: 6px;
}
.build-line.ok { box-shadow: 0 0 0 3px var(--ok); padding: 12px 8px; }
.build-line.no { box-shadow: 0 0 0 3px var(--no); padding: 12px 8px; }
.build-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile-slot { display: inline-block; min-width: 40px; min-height: 46px; border-radius: 12px; background: var(--line); }
.tile {
  background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 9px 14px; font-weight: 800; font-size: 16px;
  box-shadow: 0 3px 0 var(--line); animation: bubbleIn .18s ease;
}
.tile-slot .tile { display: block; }
.locked .tile { pointer-events: none; }

/* pary */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.col { display: grid; gap: 10px; align-content: start; }
.mt {
  min-height: 64px; background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 10px; font-weight: 800; font-size: 14px;
  box-shadow: 0 3px 0 var(--line); transition: all .15s;
}
.mt.sel { border-color: var(--u); background: var(--u-tint); box-shadow: 0 3px 0 var(--u); }
@media (prefers-color-scheme: dark) { .mt.sel { background: rgba(255, 255, 255, .06); } }
.mt.done { border-color: var(--ok); background: var(--ok-t); opacity: .55; box-shadow: none; pointer-events: none; }
.mt.bad { border-color: var(--no); background: var(--no-t); animation: shake .35s; }

/* ćwiczenie własne */
.practice-input { width: 100%; border: 2px solid var(--line); background: var(--card); border-radius: 16px; padding: 14px; resize: vertical; min-height: 96px; outline: none; }
.practice-input:focus { border-color: var(--u); }
.practice-model { margin-top: 16px; background: var(--ok-t); border-radius: 16px; padding: 16px; animation: slideUp .25s ease; }
.practice-model p { margin: 4px 0 0; font-weight: 800; font-size: 17px; }
.tips { margin: 10px 0 0; padding-left: 20px; color: var(--navy-2); font-weight: 600; }

/* ---------------- ekrany z zakładkami ---------------- */

.app { padding-bottom: calc(76px + var(--safe-b)); }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; gap: 6px; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 12px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 2px solid var(--line);
}
.chip { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 8px 8px; border-radius: 12px; font-weight: 900; font-size: 16px; }
.chip:active { background: var(--line); }
.chip-course span { font-size: 14px; color: var(--muted); }
.chip-streak { color: var(--muted); filter: grayscale(1); }
.chip-streak.lit { color: #FF8A00; filter: none; }
.chip-xp b { color: #E0A100; } .chip-xp small { color: var(--muted); font-weight: 800; }
.sync { position: relative; font-size: 22px; color: var(--muted); line-height: 1; }
.sync b { position: absolute; right: -6px; bottom: -4px; font-size: 11px; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.sync-ok b { background: var(--ok); } .sync-wait b { background: var(--soft); } .sync-guest b { background: var(--coral); }

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 520px; z-index: 10;
  display: flex; background: var(--card); border-top: 2px solid var(--line); padding: 6px 8px calc(6px + var(--safe-b));
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 2px solid transparent; border-radius: 14px; padding: 6px 0; font-size: 12px; font-weight: 800; color: var(--muted); }
.tab-ic { font-size: 24px; line-height: 1.1; filter: grayscale(.7); opacity: .8; }
.tab.on { color: var(--teal-d); background: var(--teal-t); border-color: color-mix(in srgb, var(--teal) 40%, transparent); }
.tab.on .tab-ic { filter: none; opacity: 1; }
@media (prefers-color-scheme: dark) { .tab.on { color: #5FE0D2; } }

/* ścieżka */
.path-wrap { padding: 14px 14px 30px; }
.hello { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; box-shadow: var(--shadow); }
.ring { position: relative; width: 56px; height: 56px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.hello-txt b { display: block; font-size: 16px; }
.hello-txt small { color: var(--muted); font-weight: 700; }

.unit { margin-bottom: 18px; }
.unit-head {
  position: sticky; top: calc(64px + var(--safe-t)); z-index: 4;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--u); color: #fff; border-radius: 18px; padding: 14px 16px; box-shadow: 0 4px 0 var(--u-shade);
}
.unit-head small { font-weight: 900; text-transform: uppercase; letter-spacing: .08em; opacity: .85; font-size: 12px; }
.unit-head h2 { font-size: 20px; margin: 2px 0; }
.unit-head p { margin: 0; font-weight: 700; opacity: .92; }
.unit-guide { flex: none; width: 46px; height: 46px; border-radius: 14px; border: 2px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .12); font-size: 20px; }

.path { display: flex; flex-direction: column; align-items: center; padding: 26px 0 8px; gap: 18px; }
.node-row { position: relative; transform: translateX(var(--x)); display: flex; justify-content: center; }
.node {
  width: 76px; height: 70px; border-radius: 50%; border: 0; display: grid; place-items: center; font-size: 30px; font-weight: 900;
  background: var(--u); color: #fff; box-shadow: 0 7px 0 var(--u-shade); transition: transform .1s, box-shadow .1s;
}
.node:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--u-shade); }
.node.locked { background: var(--line); color: var(--muted); box-shadow: 0 7px 0 var(--line-d); font-size: 24px; }
.node.open { background: var(--card); color: var(--u); box-shadow: 0 0 0 4px var(--u) inset, 0 7px 0 var(--u-shade); }
.node.done span { font-size: 32px; }
.node.gold { background: linear-gradient(160deg, #FFD95A, var(--gold)); box-shadow: 0 7px 0 var(--gold-d); }
.node.current { animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { outline: 6px solid color-mix(in srgb, var(--u) 25%, transparent); outline-offset: 4px; } 50% { outline: 10px solid color-mix(in srgb, var(--u) 10%, transparent); outline-offset: 6px; } }
.start-bubble {
  position: absolute; top: -40px; left: 50%; transform: translateX(-50%); z-index: 2;
  background: var(--card); color: var(--u); border: 2px solid var(--line); font-weight: 900; padding: 6px 14px; border-radius: 12px;
  letter-spacing: .08em; font-size: 14px; animation: float 1.6s ease-in-out infinite; white-space: nowrap;
}
.start-bubble::after { content: ''; position: absolute; bottom: -8px; left: 50%; width: 12px; height: 12px; background: var(--card); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }
@keyframes float { 50% { transform: translate(-50%, -5px); } }
.node-tiko { position: absolute; top: -6px; }
.node-row.tk-r .node-tiko { left: calc(100% + 18px); }
.node-row.tk-l .node-tiko { right: calc(100% + 18px); }
.path-end { text-align: center; padding: 16px; color: var(--muted); font-weight: 700; }
.trophy { font-size: 64px; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .08)); }
.path-end small { font-weight: 700; }

/* strony */
.page { padding: 16px 16px 30px; }
.page h1 { font-size: 26px; }
.sec-title { font-size: 18px; margin: 26px 2px 10px; }
.page-hero { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.page-hero p { margin: 4px 0 0; color: var(--muted); font-weight: 700; }
.list { padding: 4px 16px; }
.quest { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 2px solid var(--line); }
.quest:last-child { border-bottom: 0; }
.q-ic { font-size: 30px; }
.q-body { flex: 1; }
.q-body b { display: block; margin-bottom: 6px; }
.q-chest { font-size: 30px; }
.quest.done .q-chest { animation: hop 1.2s ease-in-out infinite; }
.pbar { position: relative; height: 18px; background: var(--line); border-radius: 99px; overflow: hidden; }
.pbar i { position: absolute; inset: 0 auto 0 0; background: var(--gold); border-radius: 99px; transition: width .5s; }
.pbar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 900; color: var(--navy); }
.pbar.lvl { height: 10px; margin: 8px 0 4px; } .pbar.lvl i { background: var(--teal); }
.pbar.thin { height: 6px; margin-top: 8px; }
.week { display: flex; justify-content: space-between; gap: 6px; margin: 4px 0 12px; }
.wd { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 900; color: var(--muted); }
.wd i { width: 36px; height: 36px; border-radius: 50%; background: var(--line); display: grid; place-items: center; font-style: normal; font-size: 18px; }
.wd.on i { background: #FFE5C2; }
@media (prefers-color-scheme: dark) { .wd.on i { background: #4A3415; } }
.wd.today span { color: var(--coral); }
.wd.today i { box-shadow: 0 0 0 3px var(--coral); }

.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.profile-head > div { flex: 1; }
.profile-head small { font-weight: 700; color: var(--muted); }
.avatar { width: 84px; height: 84px; border-radius: 50%; border: 3px dashed var(--line-d); background: var(--card); font-size: 46px; flex: none; }
.cloud { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.cloud > div { flex: 1; } .cloud b { display: block; } .cloud small { display: block; color: var(--muted); font-weight: 700; overflow-wrap: anywhere; }
.cloud > div { min-width: 0; }
.cloud-ic { font-size: 26px; }
.cloud.guest { border-color: #FFC9BF; background: #FFF4F1; }
@media (prefers-color-scheme: dark) { .cloud.guest { background: #3A2422; border-color: #6B3A33; } }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.stat span { font-size: 26px; grid-row: span 2; }
.stat b { font-size: 20px; } .stat small { color: var(--muted); font-weight: 700; font-size: 12px; }
.chart { margin-top: 10px; }
.bars { display: flex; gap: 8px; height: 130px; align-items: flex-end; margin-top: 12px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar-col i { width: 100%; max-width: 30px; background: var(--teal-t); border-radius: 8px 8px 4px 4px; position: relative; min-height: 4px; }
.bar-col.today i { background: var(--teal); }
.bar-col em { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; font-weight: 900; color: var(--muted); }
.bar-col span { font-size: 12px; font-weight: 900; color: var(--muted); }
.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 14px; text-align: center; }
.badge .b-ic { font-size: 34px; display: block; filter: grayscale(1); opacity: .45; }
.badge.got .b-ic { filter: none; opacity: 1; }
.badge.got { border-color: color-mix(in srgb, var(--gold) 60%, var(--line)); }
.badge b { display: block; font-size: 14px; margin-top: 4px; } .badge small { color: var(--muted); font-weight: 700; font-size: 12px; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 2px solid var(--line); font-weight: 800; }
.set:last-child { border-bottom: 0; }
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 9px; font-weight: 900; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--teal-d); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.switch { width: 52px; height: 30px; border-radius: 99px; border: 0; background: var(--line-d); position: relative; transition: background .2s; }
.switch i { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch.on { background: var(--teal); } .switch.on i { transform: translateX(22px); }
.link-row { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 2px solid var(--line); padding: 14px 0; font-weight: 800; }
.link-row:last-child { border-bottom: 0; }
.link-row.danger { color: var(--no); }
.foot-note { text-align: center; color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 28px; }

/* ---------------- formularze ---------------- */

.field { width: 100%; border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 14px 16px; font-weight: 700; outline: none; transition: border-color .15s; }
.field:focus { border-color: var(--teal); }
.field-inline { width: 60%; padding: 8px 12px; text-align: right; }
.form { display: grid; gap: 14px; margin-top: 18px; }
.lbl { display: grid; gap: 6px; font-weight: 800; font-size: 14px; color: var(--navy-2); }
.lbl small { color: var(--muted); font-weight: 700; }
.pass { position: relative; display: block; }
.eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; font-size: 18px; opacity: .6; }
.form-err { margin: 0; background: var(--no-t); color: var(--no-d); padding: 10px 14px; border-radius: 12px; font-weight: 800; }
@media (prefers-color-scheme: dark) { .form-err { color: #FF9AA0; } }
.auth-body { flex: 1; padding: 0 22px calc(30px + var(--safe-b)); display: flex; flex-direction: column; }
.auth-body h1 { text-align: center; font-size: 26px; margin: 4px 0 6px; }
.auth-tiko { display: flex; justify-content: center; }
.auth-body .link { align-self: center; margin-top: 12px; }
.switch-auth { text-align: center; color: var(--muted); font-weight: 700; margin: 10px 0 0; }
.fine { font-size: 12px; color: var(--muted); text-align: center; margin: 16px 0 0; font-weight: 600; }
.onboard-body .field { margin-top: 6px; font-size: 18px; }

/* ---------------- po lekcji ---------------- */

.finish { align-items: center; text-align: center; padding: calc(30px + var(--safe-t)) 22px 0; }
.finish h1 { font-size: 30px; margin: 8px 0 20px; color: var(--gold-d); }
.finish p { color: var(--navy-2); font-weight: 700; max-width: 360px; }
.finish-hero { margin-top: auto; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.tile-stat { border-radius: 16px; border: 2px solid; overflow: hidden; animation: popIn .4s ease backwards; }
.tile-stat:nth-child(2) { animation-delay: .1s; } .tile-stat:nth-child(3) { animation-delay: .2s; }
@keyframes popIn { from { transform: scale(.6); opacity: 0; } }
.tile-stat small { display: block; color: #fff; font-weight: 900; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 5px 2px; }
.tile-stat b { display: block; font-size: 24px; padding: 10px 0; background: var(--card); }
.t-xp { border-color: var(--gold); } .t-xp small { background: var(--gold); } .t-xp b { color: var(--gold-d); }
.t-acc { border-color: var(--ok); } .t-acc small { background: var(--ok); } .t-acc b { color: var(--ok-d); }
.t-time { border-color: #4AA3FF; } .t-time small { background: #4AA3FF; } .t-time b { color: #1F7FE0; }
.extras { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
.extras span { background: var(--card); border: 2px solid var(--line); border-radius: 99px; padding: 6px 12px; font-weight: 800; font-size: 14px; animation: popIn .4s .35s ease backwards; }
.finish-foot { margin-top: auto; width: 100%; padding: 22px 0 calc(20px + var(--safe-b)); }
.finish-foot.stack { display: grid; gap: 12px; }
.streak-screen .flame { font-size: 120px; margin-top: auto; animation: flame 1.4s ease-in-out infinite; transform-origin: bottom center; }
@keyframes flame { 50% { transform: scale(1.06) rotate(-2deg); } }
.streak-num { font-size: 76px; font-weight: 900; color: #FF8A00; line-height: 1; }
.streak-screen h1 { color: #FF8A00; margin-bottom: 8px; }
.streak-screen .week { width: 100%; margin-top: 18px; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--x), 105vh) rotate(var(--r)); } }

/* ---------------- okna ---------------- */

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15, 20, 35, 0); display: flex; align-items: center; justify-content: center; padding: 20px; transition: background .2s; }
.modal.open { background: rgba(15, 20, 35, .5); }
.modal-card { background: var(--card); border-radius: 24px; padding: 22px; width: 100%; max-width: 420px; text-align: center; transform: scale(.94); opacity: 0; transition: all .2s; max-height: 88dvh; overflow-y: auto; }
.modal.open .modal-card { transform: none; opacity: 1; }
.modal-sheet { align-items: flex-end; padding: 0; }
.modal-sheet .modal-card { max-width: 520px; border-radius: 24px 24px 0 0; transform: translateY(40px); padding-bottom: calc(22px + var(--safe-b)); }
.modal-card h3 { font-size: 22px; margin-bottom: 8px; }
.modal-card p { color: var(--navy-2); font-weight: 600; margin: 0 0 14px; }
.modal-tiko { display: flex; justify-content: center; margin-bottom: 4px; }
.modal-actions { display: grid; gap: 12px; margin-top: 14px; }
.modal .form { text-align: left; margin-top: 8px; }
.streak-big { font-size: 64px; } .streak-big b { color: #FF8A00; font-size: 48px; margin-left: 6px; }
.lesson-sheet .ls-icon { width: 72px; height: 72px; border-radius: 22px; background: var(--u); display: grid; place-items: center; font-size: 36px; margin: 0 auto 10px; box-shadow: 0 5px 0 var(--u-shade); }
.lesson-sheet small { font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-size: 12px; }
.lesson-sheet h3 { margin-top: 4px; }
.locked-note { background: var(--line); border-radius: 14px; padding: 12px; }
.unit-modal-emoji { font-size: 54px; }
.lesson-list { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; display: grid; gap: 8px; }
.lesson-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; }
.lesson-list li > span { font-size: 22px; } .lesson-list li > div { flex: 1; }
.lesson-list b { display: block; font-size: 15px; } .lesson-list small { color: var(--muted); font-weight: 600; font-size: 13px; }
.lesson-list i { color: var(--ok); font-style: normal; font-weight: 900; }
.lesson-list li.done { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); }
.avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 10px; }
.avatars button { font-size: 38px; background: var(--bg); border: 2px solid var(--line); border-radius: 18px; padding: 10px 0; }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; z-index: 120; background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; box-shadow: var(--shadow); transition: all .25s; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.ok { background: var(--ok-d); } .toast.err { background: var(--no-d); }

@media (min-width: 560px) {
  #app { box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(27, 37, 64, .12); background: var(--bg); }
}
@media (max-width: 360px) {
  .prompt { font-size: 19px; }
  .chip { padding: 6px 5px; font-size: 15px; }
  .chip-course span { display: none; }
  .node-tiko { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
