/* Hablamos – spokojny, kolumnowy interfejs z trybem jasnym i ciemnym */

/* ---------- Tokeny: tryb jasny ---------- */
:root {
  color-scheme: light;
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-2: #f1ede7;
  --surface-3: #e8e3db;
  --text: #1f1d1a;
  --muted: #69635b;
  --border: #e3ddd4;
  --border-strong: #cfc7bb;
  --shadow: 0 1px 2px rgb(40 30 20 / .06), 0 6px 20px rgb(40 30 20 / .06);
  --shadow-lg: 0 20px 60px rgb(20 15 10 / .22);

  --accent: #c2410c;
  --accent-hover: #a7360a;
  --on-accent: #ffffff;
  --accent-soft: #fbe9df;
  --accent-text: #9a3412;

  --sel: #3b3b98;
  --sel-soft: #ebebfa;
  --sel-text: #2e2e7d;

  --ok: #0f766e;
  --ok-soft: #dcf1ee;
  --ok-text: #0b5a54;
  --bad: #be123c;
  --bad-soft: #fce6eb;
  --bad-text: #9f1239;

  --gold: #d99a0b;
  --star-off: #ddd6cc;

  /* Poziomy zaawansowania 1–5: kolor (tekst, kropka) + tło */
  --tier-1: #15803d; --tier-1-soft: #dcfce7;
  --tier-2: #1d4ed8; --tier-2-soft: #dbeafe;
  --tier-3: #a16207; --tier-3-soft: #fef3c7;
  --tier-4: #b91c1c; --tier-4-soft: #fee2e2;
  --tier-5: #7e22ce; --tier-5-soft: #f3e8ff;
  --on-tier: #ffffff;

  --radius: 18px;
  --radius-sm: 12px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --max: 1120px;
}

/* ---------- Tokeny: tryb ciemny ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161513;
  --surface: #1f1d1a;
  --surface-2: #292622;
  --surface-3: #34302b;
  --text: #f2eee8;
  --muted: #aaa298;
  --border: #36322c;
  --border-strong: #4a443c;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .25);
  --shadow-lg: 0 20px 60px rgb(0 0 0 / .6);
  --accent: #f08a4b;
  --accent-hover: #f6a06a;
  --on-accent: #1d0f06;
  --accent-soft: #3a2418;
  --accent-text: #f7b48a;
  --sel: #a5a8f5;
  --sel-soft: #262747;
  --sel-text: #c5c7fb;
  --ok: #3cc9b4;
  --ok-soft: #133430;
  --ok-text: #7fe3d3;
  --bad: #f7728a;
  --bad-soft: #3d1820;
  --bad-text: #fca5b5;
  --gold: #f2bf3c;
  --star-off: #46413a;
  --tier-1: #4ade80; --tier-1-soft: #12301d;
  --tier-2: #7aa7ff; --tier-2-soft: #172544;
  --tier-3: #facc15; --tier-3-soft: #362b08;
  --tier-4: #f87171; --tier-4-soft: #3b1515;
  --tier-5: #c084fc; --tier-5-soft: #2d1945;
  --on-tier: #111111;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161513;
    --surface: #1f1d1a;
    --surface-2: #292622;
    --surface-3: #34302b;
    --text: #f2eee8;
    --muted: #aaa298;
    --border: #36322c;
    --border-strong: #4a443c;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .25);
    --shadow-lg: 0 20px 60px rgb(0 0 0 / .6);
    --accent: #f08a4b;
    --accent-hover: #f6a06a;
    --on-accent: #1d0f06;
    --accent-soft: #3a2418;
    --accent-text: #f7b48a;
    --sel: #a5a8f5;
    --sel-soft: #262747;
    --sel-text: #c5c7fb;
    --ok: #3cc9b4;
    --ok-soft: #133430;
    --ok-text: #7fe3d3;
    --bad: #f7728a;
    --bad-soft: #3d1820;
    --bad-text: #fca5b5;
    --gold: #f2bf3c;
    --star-off: #46413a;
    --tier-1: #4ade80; --tier-1-soft: #12301d;
    --tier-2: #7aa7ff; --tier-2-soft: #172544;
    --tier-3: #facc15; --tier-3-soft: #362b08;
    --tier-4: #f87171; --tier-4-soft: #3b1515;
    --tier-5: #c084fc; --tier-5-soft: #2d1945;
    --on-tier: #111111;
  }
}

/* ---------- Podstawy ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100dvh;
  transition: background-color .25s, color .25s;
}
h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }
kbd {
  font-family: inherit;
  font-size: .8em;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: .05em .45em;
  background: var(--surface-2);
}
strong { font-weight: 700; }

:focus-visible { outline: 3px solid var(--sel); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.sr-only, .skip-link:not(:focus) {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

.boot { max-width: 640px; margin: 0 auto; padding: 48px 16px; text-align: center; color: var(--muted); }
.boot h1 { color: var(--text); margin-bottom: 12px; font-size: 1.4rem; }
.boot pre { background: var(--surface-2); padding: 10px; border-radius: 10px; }
.boot p + p, .boot pre + p { margin-top: 10px; }

.muted { color: var(--muted); }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .15s, transform .1s, box-shadow .15s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; opacity: .75; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { box-shadow: none; }
.btn-secondary, .btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover, .btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--bad); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #2a0710; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #2a0710; } }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Pasek górny ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--max); margin: 0 auto;
  padding: 8px 16px;
  display: flex; align-items: center; gap: 6px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1.3rem; font-weight: 800; line-height: 1;
  padding-bottom: 2px;
}
.logo-text { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
.stats { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 34px;
  padding: 0 11px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .9rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pill svg { width: 16px; height: 16px; }
.pill-streak { background: var(--accent-soft); color: var(--accent-text); }
.pill-xp { color: var(--sel-text); background: var(--sel-soft); }

@media (max-width: 520px) {
  .logo-text { display: none; }
}

/* ---------- Układ kolumnowy ---------- */
.screen { max-width: var(--max); margin: 0 auto; padding: 24px 16px 56px; }
.layout-split { display: grid; gap: 24px; }
.layout-split > * { min-width: 0; }
@media (min-width: 760px) {
  .layout-split { grid-template-columns: minmax(0, 1fr) minmax(250px, 320px); gap: 28px; align-items: start; padding-top: 36px; }
  .layout-split--left { grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); }
  .col-side { position: sticky; top: 84px; }
}
.col-side { display: grid; gap: 16px; align-content: start; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }

.eyebrow { color: var(--accent-text); font-weight: 700; font-size: .85rem; letter-spacing: .08em; text-transform: uppercase; }
.hero h1, .page-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.015em;
  margin-top: 6px;
}
.lead { color: var(--muted); margin-top: 8px; font-size: 1.05rem; max-width: 46ch; }
.section-title { font-size: .85rem; font-weight: 700; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin: 32px 0 12px; }

.bar { display: block; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem; font-weight: 700;
  white-space: nowrap;
}
.tag svg { width: 13px; height: 13px; }
.tag-done { background: var(--ok-soft); color: var(--ok-text); }
.tag-open { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Start: kategorie ---------- */
.cat-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
}
.cat-grid > li { display: grid; }
.cat-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-height: 170px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
a.cat-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.cat-icon {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 1.8rem;
  margin-bottom: 4px;
}
.cat-name { font-size: 1.15rem; font-weight: 700; }
.cat-desc { color: var(--muted); font-size: .9rem; }
.cat-card .bar { width: 100%; margin-top: auto; }
.cat-meta { display: flex; align-items: center; gap: 6px; width: 100%; color: var(--accent-text); font-size: .9rem; font-weight: 700; }
.cat-meta svg { width: 16px; height: 16px; margin-left: auto; }
.cat-card.is-locked { background: transparent; box-shadow: none; border-style: dashed; color: var(--muted); }
.cat-card.is-locked .cat-icon { filter: grayscale(1); opacity: .55; }
.cat-card.is-locked .tag { margin-top: auto; }

/* ---------- Poziomy zaawansowania 1–5 ---------- */
.tier-1 { --t: var(--tier-1); --t-soft: var(--tier-1-soft); }
.tier-2 { --t: var(--tier-2); --t-soft: var(--tier-2-soft); }
.tier-3 { --t: var(--tier-3); --t-soft: var(--tier-3-soft); }
.tier-4 { --t: var(--tier-4); --t-soft: var(--tier-4-soft); }
.tier-5 { --t: var(--tier-5); --t-soft: var(--tier-5-soft); }
.tier-dot, .tier-num, .tier-badge {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 999px; background: var(--t); color: var(--on-tier); font-weight: 800;
}
/* Zakładki poziomów (podkreślenie w kolorze poziomu) */
.tier-tabs {
  display: flex; align-items: flex-end; gap: clamp(8px, 2.4vw, 20px);
  margin: 4px 0 6px; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tier-tabs::-webkit-scrollbar { display: none; }
.tier-tab {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  min-height: 44px; padding: 0 2px 8px;
  border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: .95rem; font-weight: 700; cursor: pointer;
}
.tier-tab .tier-dot { width: 26px; height: 26px; font-size: .82rem; }
.tier-tab:hover { color: var(--text); }
.tier-tab[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--t, var(--text)); }
.tier-tab .tier-tab-name { display: none; }
.tier-tab[aria-pressed="true"] .tier-tab-name { display: inline; }
@media (min-width: 760px) { .tier-tab .tier-tab-name { display: inline; } }
.tier-section { margin-top: 22px; }
.tier-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tier-head .tier-num { width: 34px; height: 34px; font-size: 1rem; }
.tier-head h2 { margin: 0; font-size: 1.05rem; }
.tier-head p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.tier-cefr { font-size: .8rem; font-weight: 700; color: var(--t); margin-left: 4px; }
/* ---------- Ekran główny: nagłówek, kafelki, lista kategorii ---------- */
.dash-head { display: flex; align-items: center; gap: 16px; }
.dash-title { flex: 1; min-width: 0; display: grid; gap: 2px; }
.dash-hi { color: var(--muted); font-size: .92rem; font-weight: 600; }
.dash-head h1 { font-family: var(--font-display); font-size: clamp(1.7rem, 6vw, 2.5rem); font-weight: 700; line-height: 1.1; letter-spacing: -.015em; }
.dash-lead { margin-top: 6px; font-size: .98rem; }
.goal-ring {
  --p: 0%;
  flex: none; display: grid; place-items: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: conic-gradient(var(--accent) 0 var(--p), var(--surface-3) var(--p) 100%);
  color: var(--text); text-decoration: none;
}
.goal-ring.is-done { background: conic-gradient(var(--ok) 0 100%); }
.goal-ring span {
  display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%;
  background: var(--bg); font-size: .78rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.stat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 16px 0 0; }
.stat-tiles > div {
  display: flex; flex-direction: column-reverse; gap: 2px;
  padding: 12px 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border);
}
.stat-tiles dt { color: var(--muted); font-size: .78rem; font-weight: 600; }
.stat-tiles dd { margin: 0; font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-tiles small { font-size: .75rem; color: var(--muted); font-weight: 700; }

.cat-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.cat-list > li { display: grid; }
.cat-row {
  display: flex; align-items: center; gap: 14px;
  min-height: 76px; padding: 12px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
a.cat-row:hover { border-color: var(--t, var(--accent)); transform: translateY(-1px); }
.cat-row.is-next { border: 2px solid var(--accent); padding: 11px 13px; }
.cat-row .cat-icon {
  flex: none; display: grid; place-items: center;
  width: 50px; height: 50px; margin: 0;
  border-radius: 14px; background: var(--t-soft, var(--surface-2));
  font-size: 1.6rem;
}
.cat-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cat-row .cat-name { font-size: 1.02rem; font-weight: 700; overflow-wrap: anywhere; }
.cat-row .cat-meta { display: block; width: auto; color: var(--muted); font-size: .85rem; font-weight: 600; }
.cat-row .cat-meta strong { color: var(--accent-text); }
.cat-row > svg { width: 18px; height: 18px; color: var(--muted); }
.cat-row.is-locked { border-style: dashed; color: var(--muted); }
.cat-row.is-locked .cat-icon { filter: grayscale(1); opacity: .55; }
.ring {
  --p: 0%;
  flex: none; display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: conic-gradient(var(--t, var(--accent)) 0 var(--p), var(--surface-3) var(--p) 100%);
}
.ring::after { content: ''; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); }
.row-done { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--ok-soft); color: var(--ok-text); }
.row-done svg { width: 18px; height: 18px; }
.row-go { flex: none; color: var(--muted); }
.row-go svg { width: 18px; height: 18px; display: block; }
.row-pill {
  flex: none; padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--border-strong); color: var(--muted);
  font-size: .8rem; font-weight: 800;
}
.row-pill.is-accent { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

.tier-tag {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; justify-self: start;
  padding: 4px 12px 4px 4px; margin: 4px 0 2px;
  border-radius: 999px; background: var(--t-soft); color: var(--text); font-size: .85rem; font-weight: 700;
}
.tier-tag .tier-dot { width: 22px; height: 22px; font-size: .78rem; }

.stat-list { display: grid; gap: 2px; }
.stat-list > div {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.stat-list > div:last-child { border-bottom: 0; }
.stat-list dt { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.stat-list dt svg { width: 18px; height: 18px; color: var(--accent); }
.stat-list dd { font-weight: 700; font-variant-numeric: tabular-nums; }
.tip-card { background: var(--sel-soft); border-color: transparent; box-shadow: none; }
.tip-card h2 { color: var(--sel-text); }
.fact-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.fact-head h2 { margin: 0; }
.fact-head .link-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; }
.fact-head .link-btn svg { width: 14px; height: 14px; }
.fact-card p { margin: 6px 0 0; line-height: 1.55; }
.fact-kind { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.fact-kind.is-lang { background: var(--surface); color: var(--sel-text); }
.fact-kind.is-spain { background: var(--accent-soft); color: var(--accent-text); }
.fact-mobile { margin-top: 16px; }
@media (min-width: 760px) { .fact-mobile { display: none; } }
@media (max-width: 759px) { .fact-desktop { display: none; } }

/* ---------- Kategoria: poziomy ---------- */
.unit-card { display: grid; gap: 10px; }
.unit-card h1 { font-family: var(--font-display); font-size: 2.1rem; font-weight: 700; line-height: 1.1; }
.unit-card .lead { margin-top: 0; font-size: .95rem; }
.unit-icon {
  display: grid; place-items: center;
  width: 60px; height: 60px;
  border-radius: 16px;
  background: var(--accent-soft);
  font-size: 2rem;
}
.unit-progress { display: grid; gap: 8px; font-size: .9rem; color: var(--muted); margin: 6px 0 4px; }
.unit-card .btn { width: 100%; }
.done-note { display: flex; align-items: center; gap: 8px; color: var(--ok-text); font-weight: 700; }
.done-note svg { width: 18px; height: 18px; }
.hint { font-size: .85rem; color: var(--muted); }

.lvl-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
}
.lvl-grid > li { display: grid; }
.lvl-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .15s, border-color .15s;
}
a.lvl-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.lvl-card.is-next { border: 2px solid var(--accent); padding: 17px; }
.lvl-card.locked { background: transparent; box-shadow: none; border-style: dashed; color: var(--muted); }
.lvl-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lvl-num { font-size: .8rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.lvl-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 6px; font-variant-numeric: tabular-nums; }
.lvl-sub { color: var(--muted); font-size: .9rem; }
.lvl-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-height: 24px; }
.lvl-score { font-size: .85rem; color: var(--muted); font-weight: 700; }
.lvl-cta { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--accent-text); font-weight: 700; font-size: .9rem; }
.lvl-cta svg { width: 16px; height: 16px; }

.stars { display: inline-flex; gap: 2px; font-size: 1.05rem; line-height: 1; }
.stars.big { font-size: 2.2rem; gap: 6px; margin-top: 8px; }
.stars.big .star { animation: star-in .45s cubic-bezier(.3, 1.5, .5, 1) both; animation-delay: calc(.5s + var(--i) * .15s); }

/* ---------- Lekcja ---------- */
.lesson { display: flex; flex-direction: column; min-height: 100dvh; }
.lesson-top {
  width: 100%; max-width: var(--max); margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px 6px;
}
.lesson-close { font-size: 1.2rem; }
.lesson-count { font-size: .9rem; color: var(--muted); min-width: 3.2em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.progress { flex: 1; display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: clamp(2px, .6vw, 4px); }
.progress-seg { height: 7px; border-radius: 99px; background: var(--surface-3); transition: background-color .3s; }
.progress-seg.is-current { background: var(--accent); }
.progress-seg.is-ok { background: var(--ok); }
.progress-seg.is-retry { background: var(--bad); }

.lesson-body { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: 16px 16px 28px; }
.question { display: grid; gap: 22px; }
@media (min-width: 760px) {
  .lesson-body { padding-top: 48px; }
  .question { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 48px); align-items: center; }
  .question .prompt { min-height: 280px; }
}
.question.enter { animation: fade-in .3s ease-out; }
.question.shake .exercise-slot { animation: shake .4s; }
.retry-badge { color: var(--accent-text); font-size: .9rem; font-weight: 700; margin-bottom: 6px; }
.instruction { font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
.prompt {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  min-height: 150px;
  margin-top: 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.prompt-text {
  font-size: clamp(2.8rem, 13vw, 4.6rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.prompt-text.is-word { font-family: var(--font-display); font-weight: 700; letter-spacing: 0; font-size: clamp(1.8rem, 7vw, 2.7rem); color: var(--sel-text); }

.speaker {
  flex: none;
  display: grid; place-items: center;
  width: 50px; height: 50px;
  border: 0;
  border-radius: 50%;
  background: var(--sel-soft);
  color: var(--sel-text);
  cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.speaker svg { width: 24px; height: 24px; }
.speaker:hover { background: color-mix(in srgb, var(--sel) 22%, var(--surface)); }
.speaker:active { transform: scale(.94); }
.speaker.pulse { animation: pulse .4s; }

.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color .12s, border-color .12s, transform .1s;
}
.choice:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-2); }
.choice:active:not(:disabled) { transform: scale(.99); }
.choice-key {
  flex: none;
  display: grid; place-items: center;
  width: 28px; height: 28px; padding: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: .85rem;
}
.choice-label { overflow-wrap: anywhere; }
.choice.selected { border-color: var(--sel); background: var(--sel-soft); color: var(--sel-text); }
.choice.selected .choice-key { background: var(--sel); border-color: var(--sel); color: var(--surface); }
.choice:disabled { cursor: default; }
.choice.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-text); animation: pop .3s; }
.choice.correct .choice-key { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-text); }
.choice.wrong .choice-key { background: var(--bad); border-color: var(--bad); color: var(--surface); }

.answer-input {
  width: 100%;
  min-height: 60px;
  padding: 14px 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
}
.answer-input::placeholder { color: var(--muted); opacity: .8; }
.answer-input:focus { outline: none; border-color: var(--sel); box-shadow: 0 0 0 4px var(--sel-soft); }
.answer-input.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-text); }
.answer-input.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-text); }
.accent-keys { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.accent-key {
  min-width: 46px; height: 46px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 1.2rem; font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.accent-key:hover:not(:disabled) { background: var(--surface-3); }
.accent-key:active:not(:disabled) { transform: scale(.95); }
.accent-key:disabled { opacity: .45; cursor: default; }

.lesson-footer {
  position: sticky; bottom: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  transition: background-color .2s;
}
.footer-inner { max-width: var(--max); margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.footer-inner .btn { width: 100%; }
.feedback:empty { display: none; }
.feedback { display: flex; align-items: flex-start; gap: 12px; }
.fb-icon {
  flex: none;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.2rem; font-weight: 800;
}
.fb-text { flex: 1; min-width: 0; }
.fb-title { font-size: 1.15rem; font-weight: 700; }
.fb-detail, .fb-pair { font-size: .98rem; }
.fb-pair { opacity: .85; }
.feedback .speaker { width: 44px; height: 44px; background: var(--surface); }

.lesson-footer[data-state="correct"] { background: var(--ok-soft); border-top-color: transparent; color: var(--ok-text); }
.lesson-footer[data-state="correct"] .fb-icon { background: var(--ok); color: var(--surface); }
.lesson-footer[data-state="wrong"] { background: var(--bad-soft); border-top-color: transparent; color: var(--bad-text); }
.lesson-footer[data-state="wrong"] .fb-icon { background: var(--bad); color: var(--surface); }
.lesson-footer[data-state="correct"] .btn-check { background: var(--ok); color: var(--surface); box-shadow: none; }
.lesson-footer[data-state="wrong"] .btn-check { background: var(--bad); color: var(--surface); box-shadow: none; }
.lesson-footer:not([data-state="idle"]) .feedback { animation: rise .25s ease-out; }

@media (min-width: 760px) {
  .footer-inner { flex-direction: row; align-items: center; }
  .footer-inner .btn { width: auto; min-width: 200px; margin-left: auto; }
}

/* ---------- Podsumowanie ---------- */
.summary { padding-top: 32px; }
.summary-grid { display: grid; gap: 20px; max-width: 900px; margin: 0 auto; }
@media (min-width: 760px) {
  .summary { padding-top: 72px; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; }
}
.summary-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 32px 24px; }
.summary-hero h1 { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin-top: 10px; }
.summary.failed .summary-hero h1 { color: var(--accent-text); }
.ring { width: 140px; height: 140px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-track { stroke: var(--surface-3); }
.ring-value { stroke: var(--ok); stroke-linecap: round; animation: ring-fill 1s .1s ease-out both; }
.ring.bad .ring-value { stroke: var(--accent); }
.ring text { transform: rotate(90deg); transform-origin: 60px 60px; fill: var(--text); font-size: 26px; font-weight: 800; }
.summary-side { display: grid; gap: 14px; }
.summary-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.summary-stats > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 12px; }
.summary-stats dt { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.summary-stats dd { font-size: 1.35rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.summary-stats .muted { font-size: .8rem; }
.note { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font-size: .95rem; }
.note-info { background: var(--ok-soft); color: var(--ok-text); animation: rise .4s .5s both; }
.summary-actions { display: grid; gap: 10px; margin-top: 6px; }
@media (min-width: 520px) { .summary-actions { grid-template-columns: 1fr 1fr; } }

/* ---------- Ustawienia ---------- */
.page-title { margin-bottom: 20px; }
.settings-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); align-items: start; }
.settings-grid .btn { width: 100%; margin-top: 14px; }
.settings-grid .muted { font-size: .95rem; margin-top: 4px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-top: 12px; border-radius: 12px; background: var(--surface-2); }
.segmented button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.shortcuts { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }

/* ---------- Dialog ---------- */
.dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.dialog::backdrop { background: rgb(10 8 6 / .5); }
.dialog[open] { animation: pop .2s; }
.dialog h2 { font-size: 1.25rem; font-weight: 700; }
.dialog p { margin-top: 8px; color: var(--muted); }
.dialog-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
@media (min-width: 520px) {
  .dialog-actions { flex-direction: row-reverse; }
  .dialog-actions .btn { flex: 1; }
}

/* ---------- Animacje ---------- */
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes pop { 0% { transform: scale(.97); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes pulse { 50% { transform: scale(1.1); } }
@keyframes star-in { from { opacity: 0; transform: scale(.3); } }
@keyframes ring-fill { from { stroke-dashoffset: var(--c); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Wspólne: formularze, tabele, powiadomienia (aplikacja i panel)
   ========================================================================== */
/* ---------- Formularze ---------- */
.form-stack { display: grid; gap: 14px; }
.form-stack.wide { gap: 20px; }
.field { display: grid; gap: 6px; font-size: .9rem; font-weight: 700; color: var(--muted); }
.field input, .field select, .items-table input, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  font-size: 1rem;
}
textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .items-table input:focus, textarea:focus {
  outline: none;
  border-color: var(--sel);
  box-shadow: 0 0 0 4px var(--sel-soft);
}
.field input[type="range"] { padding: 0; min-height: 32px; border: 0; box-shadow: none; accent-color: var(--accent); background: transparent; }
.field output { color: var(--text); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.form-grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.form-row .field { flex: 1 1 160px; }
.form-error {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bad-soft);
  color: var(--bad-text);
  font-weight: 600;
}
.form-error ul { margin: 6px 0 0; padding-left: 20px; }
.check { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check-grid { display: grid; gap: 4px 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }

.btn-sm { min-height: 38px; padding: 6px 14px; font-size: .9rem; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.danger-text { color: var(--bad-text); }
.link-btn {
  border: 0; background: none; padding: 6px 8px;
  color: var(--accent-text); font-weight: 700; font-size: .9rem;
  cursor: pointer; border-radius: 8px;
}
.link-btn:hover { background: var(--surface-2); }
.link-btn.danger { color: var(--bad-text); }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }

/* ---------- Tabele ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th {
  text-align: left; font-size: .76rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.score { font-weight: 700; }
.score.ok { color: var(--ok-text); }
.score.bad { color: var(--accent-text); }
.tag-locked { background: var(--surface-2); color: var(--muted); }

/* ---------- Powiadomienia ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: rise .2s ease-out;
  transition: opacity .3s, transform .3s;
}
.toast-bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }
@media (min-width: 721px) {
  .cat-admin-list li > .btn-row { min-width: 168px; justify-content: flex-end; }
}

code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: .88em;
  background: var(--surface-2);
  border-radius: 6px;
  padding: .1em .4em;
}

/* ---------- Konto ucznia ---------- */
.avatar {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--sel);
  color: var(--surface);
  font-weight: 800; font-size: .95rem;
  text-decoration: none;
  flex: none;
}
a.avatar:hover { filter: brightness(1.1); }
.avatar-lg { width: 72px; height: 72px; font-size: 1.9rem; }
.avatar-sm { width: 26px; height: 26px; font-size: .75rem; vertical-align: middle; margin-right: 6px; }
.topbar-login { min-height: 36px; padding: 4px 12px; margin-left: 4px; }

.account-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  margin-top: 24px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--sel-soft);
  color: var(--sel-text);
}
.account-banner p { flex: 1 1 280px; }

.auth-screen { display: grid; place-items: start center; padding-top: 40px; }
.auth-card { width: min(440px, 100%); display: grid; gap: 14px; padding: 28px; }
.auth-card h1 { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.15; }
.auth-switch { font-size: .95rem; color: var(--muted); }
.auth-switch a { color: var(--accent-text); font-weight: 700; }

.profile-card { display: grid; justify-items: start; gap: 10px; }
.profile-card h1 { font-family: var(--font-display); font-size: 1.8rem; line-height: 1.1; overflow-wrap: anywhere; }
.profile-card > .btn { width: 100%; }
.profile-main { display: grid; gap: 16px; }
.code-box {
  width: 100%;
  display: grid; gap: 6px; justify-items: start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--accent);
  background: var(--accent-soft);
}
.code-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-text); }
.code-value { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 1.7rem; letter-spacing: .08em; color: var(--text); }
.note-warn { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--surface-2);
  font-weight: 700; text-decoration: none;
}
.chip svg { width: 16px; height: 16px; color: var(--accent); }
.chip:hover { background: var(--surface-3); }

.rank-card .link-arrow, .link-arrow { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--accent-text); font-weight: 700; text-decoration: none; }
.link-arrow svg { width: 16px; height: 16px; }
.rank-mini { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.rank-mini li { display: flex; align-items: center; gap: 8px; }
.rank-mini .rank-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-mini .rank-xp { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .9rem; }
.rank-mini .is-me .rank-name { color: var(--sel-text); font-weight: 800; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tab {
  padding: 8px 14px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-weight: 700; text-decoration: none;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab[aria-current="page"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.rank-table td { padding: 12px 10px; }
.rank-table tr.is-me td { background: var(--sel-soft); }
.rank-table tr.gap td { text-align: center; color: var(--muted); padding: 2px; }
.rank-cell { width: 3.5em; font-weight: 800; font-variant-numeric: tabular-nums; }
.medal {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  font-size: .85rem; font-weight: 800; color: #3a2a00;
}
.medal.m1 { background: #f2c94c; }
.medal.m2 { background: #d5d9de; color: #2c3036; }
.medal.m3 { background: #e0a46e; color: #3b1f08; }
.save-error { max-width: 520px; margin: 0 auto; display: grid; gap: 12px; }
.save-error h1 { font-family: var(--font-display); font-size: 1.6rem; }
.saving { display: grid; place-items: center; min-height: 50vh; }

@media (max-width: 430px) {
  .topbar [data-act="theme"] { display: none; }
  .pill { padding: 0 8px; }
}

/* ---------- Lektor ---------- */
.voice-card { grid-column: 1 / -1; }
.voice-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
@media (min-width: 900px) { .voice-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.voice-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, background-color .15s;
}
.voice-item.is-selected { border-color: var(--sel); background: var(--sel-soft); }
.voice-pick { display: flex; align-items: center; gap: 12px; cursor: pointer; min-width: 0; }
.voice-pick input { width: 20px; height: 20px; accent-color: var(--sel); flex: none; margin: 0; }
.voice-text { display: grid; min-width: 0; }
.voice-text .muted { font-size: .85rem; }
.voice-status { font-size: .82rem; font-weight: 700; color: var(--muted); text-align: right; white-space: nowrap; }
.voice-item.is-ready .voice-status { color: var(--ok-text); }
.voice-status .warn { color: var(--accent-text); }
.voice-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-left: 32px; }
.voice-bar {
  position: fixed; left: 50%; bottom: 16px; z-index: 60;
  transform: translateX(-50%);
  width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--sel) var(--p, 0%), var(--text) var(--p, 0%));
  color: var(--bg);
  font-weight: 700; font-size: .92rem;
  box-shadow: var(--shadow-lg);
}
.lesson ~ .voice-bar, body:has(.lesson) .voice-bar { bottom: 110px; }
.settings-grid .voice-actions .btn { width: auto; margin-top: 0; }
.mt-sm { margin-top: 12px; }
.prompt-text.is-long:not(.is-word) { font-size: clamp(2.1rem, 10vw, 3.6rem); white-space: nowrap; }
.prompt-text.is-word.is-long { font-size: clamp(1.4rem, 5.6vw, 2.2rem); }
.choice-label { font-variant-numeric: tabular-nums; }

/* Gwiazdki ułamkowe (SVG): wypełnienie = część szerokości gwiazdki */
.star { display: inline-block; width: 1em; height: 1em; line-height: 0; }
.star svg { width: 100%; height: 100%; display: block; }
.star-on { stop-color: var(--gold); }
.star-off { stop-color: var(--star-off); }

/* Strefa zagrożenia (profil, panel), stany poziomów, tryb gościa */
.danger-zone { border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.danger-zone h2 { color: var(--bad-text); }
.tag-tried { background: var(--sel-soft); color: var(--sel-text); }
.tag-locked { background: var(--surface-2); color: var(--muted); }
a.lvl-card.locked { opacity: .75; }
.guest-card { display: grid; gap: 10px; }
.guest-card h2 { margin: 0; }
.note-warn p { margin: 0; }

/* ---------- Zakładki Nauka | Testy ---------- */
.tabbar {
  display: flex; gap: 6px;
  max-width: var(--max); margin: 0 auto;
  padding: 14px 16px 0;
}
.tab-item {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: 99px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-weight: 700; text-decoration: none;
  transition: background-color .15s, color .15s;
}
.tab-item svg { width: 20px; height: 20px; flex: none; }
.tab-item:hover { background: var(--surface-2); color: var(--text); }
.tab-item[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

@media (max-width: 759px) {
  .tabbar {
    position: fixed; z-index: 20;
    left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    max-width: 520px; margin: 0 auto; gap: 2px;
    padding: 6px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: 0 10px 30px rgb(20 15 10 / .16);
  }
  .tab-item {
    flex: 1; flex-direction: column; justify-content: center; gap: 2px;
    min-height: 54px; padding: 4px 2px;
    border: 0; border-radius: 16px;
    font-size: .74rem;
  }
  .tab-item svg { width: 21px; height: 21px; }
  .tab-item[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
  .has-tabbar { padding-bottom: 110px; }
  body:has(.tabbar) .voice-bar { bottom: 92px; }
  body:has(.tabbar) .toasts { bottom: 92px; }
}

/* ---------- Lekcje (Nauka) ---------- */
.learn-page { max-width: 820px; display: grid; gap: 18px; align-content: start; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.learn-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 20px; }
.learn-head h1 { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 2.8rem); line-height: 1.1; letter-spacing: -.015em; margin: 4px 0 0; }
.learn-head .lead { margin-top: 6px; }
.learn-body { display: grid; gap: 16px; }

.es { font-weight: 700; color: var(--sel-text); }
.lb-text { font-size: 1.08rem; line-height: 1.6; max-width: 62ch; }
.lb h3 { font-size: 1rem; font-weight: 800; margin: 0 0 10px; }
.lb-rule {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
}
.lb-rule .lb-body { line-height: 1.6; }
.lb-rule ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.lb-tip { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--sel-soft); color: var(--sel-text); line-height: 1.55; }
.lb-tip .es { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }

.num-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.num-row {
  display: grid; grid-template-columns: minmax(70px, auto) 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.num-val { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num-word { font-weight: 600; overflow-wrap: anywhere; color: var(--sel-text); }
.num-mean { color: var(--muted); font-weight: 600; grid-column: 2; font-size: .92rem; }
.speaker.sm { width: 38px; height: 38px; }
.speaker.sm svg { width: 19px; height: 19px; }

.mistakes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mistakes li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.m-wrong { color: var(--bad-text); text-decoration-thickness: 2px; font-weight: 600; }
.m-arrow { color: var(--muted); }
.m-right { color: var(--ok-text); }
.m-note { color: var(--muted); font-size: .88rem; flex-basis: 100%; }
@media (min-width: 560px) { .m-note { flex-basis: auto; margin-left: auto; } }

.learn-cta { display: grid; gap: 10px; text-align: left; }
.learn-cta h2 { margin: 0; }
.learn-cta .btn-row { margin-top: 4px; }
.learn-cta .btn svg, .learn-head-cta .btn svg { width: 18px; height: 18px; }
.topic-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.topic-nav .btn { flex: 1 1 200px; }

/* ---------- Zgody, stopka, dokumenty ---------- */
.consents { border: 0; margin: 0; padding: 0; display: grid; gap: 10px; }
.consents .check { align-items: flex-start; margin-top: 0; font-size: .92rem; line-height: 1.45; }
.consents a, .doc-links a { color: var(--accent-text); font-weight: 700; }
.doc-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer { max-width: var(--max); margin: 0 auto; padding: 8px 16px 40px; text-align: center; color: var(--muted); font-size: .85rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-bottom: 10px; }
.footer-links a { color: var(--muted); font-weight: 600; text-decoration: none; padding: 4px 0; }
.footer-links a:hover { color: var(--text); text-decoration: underline; }
.footer-copy { margin: 0; }
.footer-by { margin: 4px 0 0; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
body:has(.lesson) .site-footer, body.admin .site-footer { display: none; }
@media (max-width: 759px) { body:has(.tabbar) .site-footer { padding-bottom: 110px; } }

/* Wybór rankingów (profil) */
.rank-prefs { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 14px 12px; margin: 0; display: grid; gap: 2px; }
.rank-prefs legend { padding: 0 6px; font-weight: 800; font-size: .95rem; }
.rank-prefs .check { margin-top: 8px; }

/* Komunikat od administratora */
.announce { max-width: min(92vw, 460px); }
.announce .ann-count { margin: 0 0 6px; font-size: .85rem; font-weight: 600; color: var(--accent-text); }
.announce .ann-body { white-space: pre-line; overflow-wrap: anywhere; max-height: 50vh; overflow-y: auto; color: var(--text); }

/* ---------- Nowe typy zadań ---------- */
.prompt.has-sub { flex-direction: column; gap: 8px; }
.prompt-sub { font-size: clamp(1.4rem, 6vw, 2rem); font-weight: 700; text-align: center; overflow-wrap: anywhere; }
.speaker.lg { width: 96px; height: 96px; }
.speaker.lg svg { width: 44px; height: 44px; }

.build { display: grid; gap: 14px; }
.build-line {
  display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start;
  min-height: 74px; padding: 12px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
}
.build-line:not(.is-empty) { border-style: solid; }
.build-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.tile {
  min-height: 46px; padding: 0 16px;
  border: 2px solid var(--border-strong); border-bottom-width: 4px; border-radius: 12px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer;
  transition: transform .1s, background-color .15s;
}
.tile:hover:not(:disabled) { background: var(--surface-2); }
.tile:active:not(:disabled) { transform: scale(.97); }
.tile.used { visibility: hidden; }
.tile.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-text); }
.tile.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-text); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-item {
  min-height: 56px; padding: 8px 12px;
  border: 2px solid var(--border-strong); border-radius: 14px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer; overflow-wrap: anywhere;
  transition: background-color .15s, border-color .15s;
}
.match-item:hover:not(:disabled) { background: var(--surface-2); }
.match-item.selected { border-color: var(--sel); background: var(--sel-soft); color: var(--sel-text); }
.match-item.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-text); cursor: default; }
.match-item.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-text); animation: shake .4s; }

.fb-pairs { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; font-size: .95rem; }

/* ---------- Fiszki ---------- */
.flash { max-width: 560px; margin: 0 auto; display: grid; gap: 18px; justify-items: center; }
.flash-top { display: flex; align-items: center; gap: 12px; width: 100%; }
.flash-top .progress { flex: 1; }
.flash-count { font-weight: 700; font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.flash-stage { width: 100%; display: grid; gap: 14px; justify-items: center; }
.flashcard {
  width: 100%; min-height: 280px; padding: 0; border: 0; background: none; cursor: pointer;
  perspective: 1200px; font: inherit; color: inherit;
}
.flash-inner {
  position: relative; display: block; width: 100%; min-height: 280px;
  transition: transform .45s cubic-bezier(.3, .7, .3, 1); transform-style: preserve-3d;
}
.flashcard.is-flipped .flash-inner { transform: rotateY(180deg); }
.flash-face {
  position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 14px;
  padding: 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.flash-back { transform: rotateY(180deg); background: var(--sel-soft); border-color: var(--sel); }
.flash-text { font-size: clamp(2.4rem, 11vw, 3.6rem); font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.flash-text.is-es { font-family: var(--font-display); font-weight: 700; color: var(--sel-text); font-size: clamp(1.8rem, 7vw, 2.7rem); }
.flash-text.is-long { font-size: clamp(1.4rem, 5.6vw, 2rem); }
.flash-hint { font-size: .85rem; color: var(--muted); }
.flash-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; }
.flash-actions .btn { min-width: 150px; }
.flash-actions kbd { margin-right: 4px; opacity: .7; }
.flash-swap { font-size: .9rem; }
.flash-done { text-align: center; width: 100%; }
@media (prefers-reduced-motion: reduce) { .flash-inner { transition: none; } }

/* Ustawienia: typy zadań */
.type-list { border: 0; padding: 0; margin: 14px 0 0; display: grid; gap: 2px; }
.check.is-off { opacity: .55; cursor: default; }
.segmented.seg-2 { grid-template-columns: repeat(2, 1fr); }
.prefs-card .segmented button { font-size: .88rem; }
.flash-actions kbd { color: inherit; background: transparent; border-color: currentColor; }
.prefs-card .segmented button { font-size: .8rem; padding: 8px 4px; line-height: 1.2; overflow-wrap: anywhere; }

/* ---------- Ustawienia: zakładki, jedna sekcja naraz ---------- */
.settings-layout { display: grid; gap: 20px; align-items: start; max-width: 860px; }
.settings-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.settings-tab {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px;
  border-radius: 99px; border: 1px solid var(--border-strong);
  color: var(--muted); font-weight: 700; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.settings-tab:hover { background: var(--surface-2); color: var(--text); }
.settings-tab[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.settings-panel { display: grid; gap: 16px; max-width: 640px; }
.settings-panel .btn { width: 100%; margin-top: 14px; }
.settings-panel .muted { font-size: .95rem; margin-top: 4px; }
.settings-panel .voice-actions .btn { width: auto; margin-top: 0; }
@media (min-width: 900px) {
  .settings-layout { grid-template-columns: 210px minmax(0, 1fr); gap: 32px; max-width: 980px; }
  .settings-tabs { flex-direction: column; flex-wrap: nowrap; position: sticky; top: 90px; }
  .settings-tab { border-radius: 14px; border-color: transparent; justify-content: flex-start; min-height: 46px; }
}
@media (max-width: 899px) {
  .settings-tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
  .settings-tabs::-webkit-scrollbar { display: none; }
}

/* ---------- Dziś: plan nauki ---------- */
.plan-card { display: grid; gap: 12px; }
.plan-card h2 { margin: 0; }
.plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.plan-count { font-weight: 700; color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plan-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.plan-item.is-done { background: var(--ok-soft); border-color: transparent; }
.plan-item.is-done .plan-text strong { text-decoration: line-through; color: var(--muted); }
.plan-check { display: grid; place-items: center; cursor: pointer; }
.plan-check input { width: 22px; height: 22px; accent-color: var(--ok); margin: 0; }
.plan-text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.plan-text strong { overflow-wrap: anywhere; }
.plan-text .muted { font-size: .88rem; width: 100%; }
.plan-item .btn { margin: 0; }
.plan-remove svg { width: 16px; height: 16px; }
.tag-learn { background: var(--sel-soft); color: var(--sel-text); }
.tag-test { background: var(--accent-soft); color: var(--accent-text); }
.tag-cards { background: var(--ok-soft); color: var(--ok-text); }
.plan-form { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; align-items: end; }
.plan-form .plan-field-wide, .plan-form .btn { grid-column: 1 / -1; }
.plan-form .btn svg { width: 18px; height: 18px; }
.suggest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.suggest-list li { display: grid; gap: 8px; }
.suggest-list li > div { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.suggest-list .muted { width: 100%; font-size: .88rem; }
.suggest-list .btn { justify-self: start; }
.suggest-list .btn svg { width: 16px; height: 16px; }
@media (max-width: 520px) {
  .plan-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .plan-item .btn { grid-column: 2 / 4; justify-self: start; }
  .plan-remove { grid-row: 1; grid-column: 3; }
  .plan-form { grid-template-columns: 1fr; }
}

/* ---------- AI (w przygotowaniu) ---------- */
.ai-card { max-width: 560px; margin: 24px auto 0; text-align: center; display: grid; justify-items: center; gap: 12px; padding: 36px 24px; }
.ai-card h1 { margin: 0; }
.ai-card .lead { margin: 0; }
.ai-icon { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 26px; background: var(--sel-soft); color: var(--sel-text); }
.ai-icon svg { width: 46px; height: 46px; }
.tag-dev { background: var(--accent-soft); color: var(--accent-text); }
.ai-card .btn-row { justify-content: center; }

/* Dziś: wybór wielu rzeczy i tryb nauki */
.plan-add { display: grid; gap: 4px; }
.plan-add > .muted { margin-bottom: 4px; }
.plan-add .btn { margin-top: 12px; }
.plan-add .btn svg { width: 18px; height: 18px; }
.pick-groups { display: grid; gap: 6px; margin-top: 10px; max-height: 420px; overflow-y: auto; padding-right: 2px; }
.pick-cat { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.pick-cat[hidden] { display: none; }
.pick-cat > summary {
  display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px;
  font-weight: 700; cursor: pointer; list-style: none;
}
.pick-cat > summary::-webkit-details-marker { display: none; }
.pick-cat > summary::after { content: '›'; margin-left: auto; color: var(--muted); font-size: 1.3rem; transition: transform .15s; }
.pick-cat[open] > summary::after { transform: rotate(90deg); }
.pick-cat-name { flex: 1; }
.pick-badge { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 99px; background: var(--accent); color: #fff; font-size: .8rem; display: inline-grid; place-items: center; }
.pick-badge[hidden] { display: none; }
.pick-items { display: grid; gap: 2px; padding: 0 8px 10px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 10px; cursor: pointer; }
.pick-row[hidden] { display: none; }
.pick-row:hover { background: var(--surface-2); }
.pick-row input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.pick-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.pick-mode { border: 0; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.pick-mode legend { font-weight: 700; margin-bottom: 8px; }
.mode-opt {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.mode-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-opt:has(input:disabled) { opacity: .55; cursor: default; }
.mode-opt input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.mode-opt > span { display: grid; gap: 2px; }
.mode-opt .muted { font-size: .9rem; }
.tag-mixtest { background: var(--accent-soft); color: var(--accent-text); }
.tag-mixcards { background: var(--ok-soft); color: var(--ok-text); }
.tag-step { background: var(--surface-2); color: var(--text); }
.plan-item.is-mix .plan-text .muted { white-space: normal; }
.mix-summary { max-width: 560px; margin: 24px auto 0; text-align: center; display: grid; justify-items: center; gap: 10px; }
.mix-summary h1 { margin: 0; font-size: clamp(2.6rem, 10vw, 3.6rem); }
.mix-from { margin: -8px 0 16px; }

/* ---------- Wyszukiwarka poziomów ---------- */
.level-search { margin: 4px 0 14px; }
.search-field {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 99px; background: var(--surface);
  box-shadow: var(--shadow);
}
.search-field:focus-within { border-color: var(--accent); }
.search-field svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1rem; padding: 12px 0; outline: none; }
.search-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.search-hit {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); text-decoration: none; transition: border-color .15s, background-color .15s;
}
.search-hit:hover { border-color: var(--border-strong); background: var(--surface-2); }
.search-icon { font-size: 1.6rem; flex: none; }
.search-text { display: grid; gap: 2px; min-width: 0; flex: 1; }
.search-text .muted { font-size: .88rem; overflow-wrap: anywhere; }
.search-match { font-size: .85rem; color: var(--accent-text); font-weight: 600; }
.search-go svg { width: 18px; height: 18px; color: var(--muted); }
.search-hit .tag svg { width: 12px; height: 12px; }

/* ---------- Opcje: rozmiar tekstu, cel dzienny, przełączniki ---------- */
html[data-textsize="large"] { font-size: 112.5%; }
html[data-textsize="xlarge"] { font-size: 125%; }
.segmented.seg-4 { grid-template-columns: repeat(4, 1fr); }
.segmented.seg-5 { grid-template-columns: repeat(5, 1fr); }
.segmented button { overflow-wrap: anywhere; }
.settings-panel .segmented button { font-size: .85rem; padding-inline: 4px; line-height: 1.2; }
.toggle-list { display: grid; gap: 2px; margin-top: 8px; }
.goal-card { display: grid; gap: 8px; }
.goal-card h2 { margin: 0; }
.goal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.goal-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.goal-card.is-done { background: var(--ok-soft); border-color: transparent; }
.goal-card.is-done .bar > span { background: var(--ok); }
.goal-card .muted { margin: 0; font-size: .92rem; }

/* ---------- Plan: dzień / tydzień / miesiąc, Premium ---------- */
.plan-views { margin: 4px 0 16px; }
.plan-views .lock-mini svg { width: 13px; height: 13px; vertical-align: -1px; opacity: .7; }
.plan-head .icon-btn { width: 36px; height: 36px; }
.plan-head .icon-btn:disabled { opacity: .35; cursor: default; }
.icon-flip svg { transform: rotate(180deg); }
.plan-head h2 { flex: 1; text-align: center; font-size: 1.05rem; }
.plan-head { align-items: center; }
.plan-item { grid-template-columns: auto minmax(0, 1fr); }
.plan-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 34px; }
.plan-actions .icon-btn { width: 34px; height: 34px; }
.plan-actions .icon-btn svg { width: 16px; height: 16px; }
.plan-move select {
  min-height: 34px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: .85rem;
}
.plan-item .plan-remove { margin-left: auto; }
.plan-item.is-compact .plan-actions { padding-left: 0; }
.plan-day-actions { justify-content: space-between; margin-top: 4px; }
.link-btn.danger { color: var(--bad-text); }

.week-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.week-day { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 8px; align-content: start; background: var(--surface); }
.week-day.is-today { border-color: var(--accent); }
.week-day header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.week-day-title { border: 0; background: none; padding: 0; font: inherit; font-weight: 800; color: var(--text); cursor: pointer; text-align: left; }
.week-day-title:hover { text-decoration: underline; }
.week-empty { margin: 0; font-size: .9rem; }
.week-day .link-btn svg { width: 14px; height: 14px; vertical-align: -2px; }

.month-card { display: grid; gap: 12px; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.month-wd { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); padding: 2px 0; }
.month-cell {
  aspect-ratio: 1 / 1; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer; display: grid; place-items: center; align-content: center; gap: 0; padding: 2px;
}
.month-cell:hover { background: var(--surface-2); }
.month-cell.is-today { border-color: var(--accent); }
.month-cell.is-selected { background: var(--text); color: var(--bg); border-color: var(--text); }
.month-cell.is-full:not(.is-selected) { background: var(--ok-soft); border-color: transparent; }
.month-num { font-weight: 800; font-size: .95rem; line-height: 1; }
.month-num small { font-size: .6rem; font-weight: 600; }
.month-dots { font-size: .68rem; font-weight: 700; opacity: .8; }

.tag-premium { background: linear-gradient(90deg, #f59e0b, #ec4899); color: #fff; }
.premium-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.premium-head h2 { margin: 0; }
.premium-lock { display: grid; gap: 10px; border-style: dashed; }
.premium-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .95rem; }
.premium-list svg { width: 16px; height: 16px; color: var(--ok); vertical-align: -3px; }
.premium-lock .muted { margin: 0; font-size: .9rem; }

.assistant-card { display: grid; gap: 10px; }
.assistant-card h3 { margin: 8px 0 0; font-size: 1rem; }
.assistant-card .muted { margin: 0; font-size: .9rem; }
.assist-actions { display: grid; gap: 6px; }
.assist-actions .btn { width: 100%; margin: 0; justify-content: flex-start; }
.auto-plan { display: grid; gap: 10px; }
.auto-cats { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow-y: auto; }
.chip-check { display: inline-flex; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: 99px; font-size: .85rem; font-weight: 600; }
.chip-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.auto-kinds { border: 0; padding: 0; margin: 0; }
.auto-kinds legend { font-weight: 700; font-size: .92rem; }
.auto-kinds .check { margin-top: 6px; }
.auto-plan .btn { margin: 0; }
.pick-when { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-top: 10px; }
@media (max-width: 520px) { .pick-when { grid-template-columns: 1fr; } }
.plan-add > .check { margin-top: 10px; }
.week-day .link-btn { display: inline-flex; align-items: center; gap: 4px; justify-self: start; text-align: left; }
.week-day .link-btn svg { display: inline-block; flex: none; }
.premium-list li { display: flex; align-items: flex-start; gap: 8px; }
.premium-list svg { flex: none; margin-top: 3px; vertical-align: 0; }

/* ---------- Test poziomujący ---------- */
.onb { max-width: 760px; display: grid; gap: 16px; }
.onb-card { display: grid; gap: 14px; }
.onb-card h1 { margin: 0; }
.onb-card .lead { margin: 0; }
.onb-q { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.onb-q legend { font-weight: 800; margin-bottom: 8px; }
.onb-q .segmented { margin-top: 0; }
.onb-test .progress { margin: 2px 0 4px; }
.onb-prompt { min-height: 120px; }
.onb-dunno { justify-self: center; }
.onb-bands { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.onb-bands li { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-weight: 600; }
.onb-bands li .muted { margin-left: auto; font-weight: 500; }
.onb-bands li.is-pass { background: var(--ok-soft); color: var(--ok-text); }
.onb-bands li.is-fail { background: var(--bad-soft); color: var(--bad-text); }
.onb-bands li.is-skipped { opacity: .6; }
.tag-level { background: var(--sel-soft); color: var(--sel-text); vertical-align: middle; font-size: .8rem; }
.onb-recs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.onb-week { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.onb-week li { display: grid; gap: 2px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; }
.onb-week li span { font-size: .9rem; color: var(--muted); }
.onb-banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; border-color: var(--accent); margin-bottom: 14px; }
.onb-banner h2 { margin: 0 0 4px; }
.onb-banner .muted { margin: 0; }
.onb-banner .btn { margin: 0; }

/* ---------- Powitanie nowej osoby ---------- */
.welcome { min-height: calc(100vh - 40px); display: grid; place-items: center; padding-block: 32px; }
.welcome-card { max-width: 560px; width: 100%; display: grid; justify-items: center; gap: 16px; text-align: center; }
.welcome-mark {
  display: grid; place-items: center; width: 92px; height: 92px; border-radius: 28px;
  background: var(--accent); color: #fff; font-family: var(--font-display); font-size: 3.4rem; font-weight: 700;
  box-shadow: var(--shadow-lg); animation: pop .5s;
}
.welcome-card h1 { margin: 0; font-size: clamp(1.8rem, 6vw, 2.6rem); }
.welcome-card .lead { margin: 0; }
.welcome-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.welcome-points li { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.welcome-points svg { width: 18px; height: 18px; color: var(--ok); flex: none; }
.welcome-actions { display: grid; gap: 10px; width: 100%; max-width: 380px; margin-top: 6px; }
.welcome-actions .btn { width: 100%; justify-content: center; }
.welcome-actions .btn svg { width: 18px; height: 18px; }
.welcome-skip { font-size: .95rem; }
.onb-account { display: grid; gap: 10px; border-color: var(--accent); }
.onb-account h2, .onb-account .muted { margin: 0; }

/* Bardzo wąskie telefony: zwarty górny pasek (motyw zmienisz też w Ustawieniach → Wygląd) */
.pill { white-space: nowrap; }
@media (max-width: 380px) {
  .topbar-inner { padding: 8px 10px; gap: 4px; }
  .stats { gap: 2px; }
  .stats .icon-btn { width: 34px; height: 38px; }
  .stats [data-act="theme"] { display: none; }
  .pill { padding: 0 8px; }
  .topbar-login { padding: 4px 10px; margin-left: 2px; }
  .stat-tiles > div { padding: 10px; }
}

/* ---------- Rozdziały na listach ---------- */
.tier-head > div { flex: 1 1 180px; min-width: 0; }
.tier-head .btn { margin-left: auto; flex: none; }
.tier-section.is-locked .cat-row { opacity: .55; filter: saturate(.5); }
.tier-section.is-locked .tier-num { background: var(--surface-3); }
.tier-lock { font-size: .7rem; margin-left: -4px; }
.exam-row { background: var(--t-soft, var(--surface-2)); border: 2px dashed var(--t, var(--border-strong)); padding: 11px 13px; }
.exam-row.is-passed { border-style: solid; }
.exam-row .cat-icon { background: var(--surface); }
@media (max-width: 520px) { .tier-head { flex-wrap: wrap; } .tier-head .btn { margin-left: 46px; } }

/* ---------- Mapa przygody ---------- */
:root {
  --sky-1: #fbeef6; --sky-2: #ecdcf7; --sky-3: #f7e3ea;
  --land-1: #8fd17f; --land-1b: #5aa552; --cliff-1: #7a5634;
  --land-2: #9fe0ef; --land-2b: #4fb3cf; --cliff-2: #3d6f8a;
  --land-3: #f6d77a; --land-3b: #dcaa45; --cliff-3: #a7743a;
  --land-4: #f59a7a; --land-4b: #d0573e; --cliff-4: #7d2d23;
  --land-5: #c7aef5; --land-5b: #8c67de; --cliff-5: #4f3390;
  --cloud: #ffffff; --ray: rgb(255 255 255 / .12);
}
:root[data-theme="dark"] { --sky-1: #1d1530; --sky-2: #2a1c3d; --sky-3: #1a1426; --cloud: #e9e3f5; --ray: rgb(255 255 255 / .03); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sky-1: #1d1530; --sky-2: #2a1c3d; --sky-3: #1a1426; --cloud: #e9e3f5; --ray: rgb(255 255 255 / .03); } }

.map-screen { max-width: 560px; }
.map-intro h1 { font-family: var(--font-display); font-size: clamp(1.8rem, 6vw, 2.5rem); line-height: 1.1; }
.map-world {
  position: relative; margin: 24px -16px 0; padding: 30px 16px 40px;
  border-radius: 28px; overflow: hidden;
  background:
    radial-gradient(60% 30% at 20% 10%, rgb(255 255 255 / .55), transparent 70%),
    radial-gradient(50% 25% at 85% 55%, rgb(255 255 255 / .4), transparent 70%),
    linear-gradient(180deg, var(--sky-2), var(--sky-1) 45%, var(--sky-3));
}
@media (min-width: 600px) { .map-world { margin-inline: 0; } }
.map-world::before { /* promienie światła jak na obrazku – delikatne smugi */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(115deg, transparent 0 60px, var(--ray) 60px 90px);
  animation: rays 40s linear infinite;
}
@keyframes rays { to { background-position: 600px 0; } }
.map-start { text-align: center; color: var(--muted); font-weight: 700; font-size: .85rem; margin: 12px 0 0; }

.land { position: relative; }
.land-sign {
  position: relative; z-index: 6;
  display: flex; align-items: center; gap: 10px;
  width: max-content; max-width: 100%; margin: 0 auto 14px;
  padding: 8px 14px 8px 8px; border-radius: 99px;
  background: var(--surface); box-shadow: var(--shadow);
}
.land-sign .tier-num { width: 32px; height: 32px; font-size: .95rem; }
.land-sign-text { display: grid; line-height: 1.2; }
.land-sign-text strong { font-size: .95rem; }
.land-sign-text span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.land-badge { font-size: 1.3rem; animation: pulse 2.4s ease-in-out infinite; }

.land-body { position: relative; animation: float 7s ease-in-out infinite; }
.land:nth-of-type(2n) .land-body { animation-delay: -3s; }
@keyframes float { 50% { transform: translateY(-8px); } }
.land-ground {
  position: absolute; inset: 0 2% 30px;
  border-radius: 140px 170px 120px 150px / 110px 130px 90px 120px;
  background:
    radial-gradient(40% 12% at 25% 20%, rgb(255 255 255 / .25), transparent 70%),
    radial-gradient(30% 10% at 75% 65%, rgb(0 0 0 / .06), transparent 70%),
    linear-gradient(180deg, var(--lt), var(--lb));
  box-shadow: inset 0 -10px 0 rgb(0 0 0 / .08), 0 18px 30px rgb(60 20 60 / .18);
}
.land-cliff {
  position: absolute; left: 8%; right: 8%; bottom: 0; height: 64px; z-index: -1;
  background: linear-gradient(180deg, var(--lc), color-mix(in srgb, var(--lc) 70%, #000));
  clip-path: polygon(0 0, 100% 0, 96% 40%, 88% 55%, 80% 100%, 66% 62%, 52% 92%, 40% 58%, 28% 86%, 16% 50%, 6% 70%, 2% 30%);
}
.land.tier-1 { --lt: var(--land-1); --lb: var(--land-1b); --lc: var(--cliff-1); }
.land.tier-2 { --lt: var(--land-2); --lb: var(--land-2b); --lc: var(--cliff-2); }
.land.tier-3 { --lt: var(--land-3); --lb: var(--land-3b); --lc: var(--cliff-3); }
.land.tier-4 { --lt: var(--land-4); --lb: var(--land-4b); --lc: var(--cliff-4); }
.land.tier-5 { --lt: var(--land-5); --lb: var(--land-5b); --lc: var(--cliff-5); }
.land-bridge { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 0 22px; }
.land-bridge span { width: 14px; height: 10px; border-radius: 50%; background: color-mix(in srgb, var(--muted) 45%, transparent); animation: float 4s ease-in-out infinite; }
.land-bridge span:nth-child(2) { animation-delay: -1s; width: 18px; }
.land-bridge span:nth-child(3) { animation-delay: -2s; }

.land-decor span { position: absolute; font-size: 1.7rem; transform: translateX(-50%); filter: drop-shadow(0 3px 2px rgb(0 0 0 / .15)); animation: sway 5s ease-in-out infinite; animation-delay: calc(var(--d, 0) * -.8s); }
.land-decor.is-faint span { opacity: .35; filter: blur(1px) grayscale(.4); font-size: 2.2rem; }
@keyframes sway { 50% { transform: translateX(-50%) rotate(-4deg) translateY(-3px); } }

.land-path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.land-path path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.land-path .road { stroke: rgb(255 255 255 / .55); stroke-width: 22; }
.land-path .road-done { stroke: #ffd35a; stroke-width: 22; filter: drop-shadow(0 0 6px rgb(255 200 60 / .7)); }
.land-path .road-line { stroke: rgb(0 0 0 / .12); stroke-width: 2; stroke-dasharray: 2 10; animation: march 1.6s linear infinite; }
@keyframes march { to { stroke-dashoffset: -24; } }

.map-nodes { list-style: none; margin: 0; padding: 0; }
.map-spot { position: absolute; transform: translate(-50%, -50%); z-index: 3; animation: pop-in .5s cubic-bezier(.3, 1.6, .5, 1) both; animation-delay: calc(var(--i) * 40ms); }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.4); } }
.map-node {
  --p: 0%;
  position: relative; display: grid; place-items: center;
  width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%;
  background: conic-gradient(var(--t) 0 var(--p), #fff var(--p) 100%);
  box-shadow: 0 5px 0 rgb(0 0 0 / .18), 0 8px 14px rgb(0 0 0 / .15);
  cursor: pointer; text-decoration: none;
  transition: transform .15s;
}
.map-node::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.map-node:hover { transform: translateY(-2px) scale(1.05); }
.map-node:active { transform: translateY(2px); box-shadow: 0 2px 0 rgb(0 0 0 / .18); }
.node-emoji { position: relative; font-size: 1.55rem; line-height: 1; }
.map-node.is-done { background: var(--t); }
.map-node.is-done::before { background: color-mix(in srgb, var(--t) 22%, #fff); }
.node-check {
  position: absolute; right: -4px; top: -4px; display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%; background: #ffd35a; color: #5a3b00;
  font-size: .75rem; font-weight: 900; box-shadow: 0 2px 0 rgb(0 0 0 / .2);
}
.map-node.is-current { width: 66px; height: 66px; background: conic-gradient(var(--accent) 0 var(--p), #fff var(--p) 100%); }
.map-node.is-current::after {
  content: ''; position: absolute; inset: -8px; border-radius: 50%;
  border: 3px solid var(--accent); animation: ping 1.8s ease-out infinite;
}
@keyframes ping { from { opacity: .9; transform: scale(.9); } to { opacity: 0; transform: scale(1.35); } }
.you-pin {
  position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%);
  padding: 4px 10px; border-radius: 99px; background: var(--accent); color: var(--on-accent);
  font-size: .72rem; font-weight: 800; white-space: nowrap; box-shadow: var(--shadow);
  animation: bob 1.4s ease-in-out infinite;
}
.you-pin::after { content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--accent); }
@keyframes bob { 50% { transform: translateX(-50%) translateY(-5px); } }
.map-node.exam { width: 72px; height: 72px; background: linear-gradient(180deg, #ffe58a, #f5b82e); }
.map-node.exam::before { inset: 6px; background: #fff8dc; }
.map-node.exam .node-emoji { font-size: 2rem; }
.map-node.exam.is-current::after { border-color: #f5b82e; }
.map-node.exam.is-done { background: linear-gradient(180deg, #ffd35a, #e09b12); }
.map-node.exam.is-done .node-emoji { animation: pulse 2.4s ease-in-out infinite; }
.node-label {
  position: absolute; top: 50%; transform: translateY(-50%);
  max-width: 120px; padding: 3px 9px; border-radius: 99px;
  background: rgb(255 255 255 / .9); color: #2b2233;
  font-size: .72rem; font-weight: 800; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.node-label.to-right { left: calc(100% + 8px); }
.node-label.to-left { right: calc(100% + 8px); }
.node-label.exam-label { top: calc(100% + 8px); left: 50%; transform: translateX(-50%); max-width: none; background: #fff3c4; }

/* Chmury nad zablokowaną krainą */
.clouds { position: absolute; inset: -20px -10px 10px; z-index: 4; pointer-events: none; }
.cloud {
  position: absolute; width: 160px; height: 58px; border-radius: 50px;
  background: var(--cloud); opacity: .97;
  box-shadow: 26px -24px 0 0 var(--cloud), 64px -32px 0 6px var(--cloud), 100px -12px 0 -6px var(--cloud), 0 14px 26px rgb(80 40 90 / .14);
  animation: drift 14s ease-in-out infinite alternate; animation-delay: calc(var(--i) * -2s);
}
.cloud:nth-child(3n) { scale: 1.25; }
.cloud:nth-child(3n+1) { width: 190px; }
.clouds::before {
  content: ''; position: absolute; inset: 8% -5%;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--cloud) 85%, transparent), transparent 70%);
  filter: blur(8px);
}
.clouds.is-clearing::before, .land.is-opening .clouds::before { animation: fade-plain 1s ease-in .3s forwards; }
@keyframes fade-plain { to { opacity: 0; } }
@keyframes drift { to { translate: 26px 0; } }
.land.is-locked .land-ground { filter: saturate(.55) brightness(1.05); }
.lock-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
  display: grid; justify-items: center; gap: 6px; width: min(86%, 300px);
  padding: 16px 18px; border-radius: 20px; text-align: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow-lg);
  backdrop-filter: blur(6px);
}
.lock-card span:not(.lock-icon) { font-size: .88rem; color: var(--muted); }
.lock-icon { font-size: 2rem; animation: wiggle 3s ease-in-out infinite; }
@keyframes wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-12deg); } 90% { transform: rotate(10deg); } 95% { transform: rotate(-6deg); } }
/* Rozwiewanie chmur: po kliknięciu „Chcę iść dalej” i przy pierwszym wejściu na mapę po zaliczeniu */
.land.is-opening .cloud.from-left, .clouds.is-clearing .cloud.from-left { animation: part-left 1.1s ease-in forwards; }
.land.is-opening .cloud.from-right, .clouds.is-clearing .cloud.from-right { animation: part-right 1.1s ease-in forwards; }
.land.is-opening .lock-card { animation: fade-out .4s ease-in forwards; }
.clouds.is-clearing .cloud { animation-delay: calc(.3s + var(--i) * 60ms) !important; }
@keyframes part-left { to { translate: -140% -10px; opacity: 0; } }
@keyframes part-right { to { translate: 140% -10px; opacity: 0; } }
@keyframes fade-out { to { opacity: 0; transform: translate(-50%, -50%) scale(.9); } }
.land.is-fresh .land-ground { animation: glow 2.2s ease-out .6s; }
@keyframes glow { 40% { box-shadow: 0 0 0 6px #fff, 0 0 60px 20px rgb(255 220 120 / .8); } }

/* Arkusz kategorii na mapie */
.map-sheet {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 30;
  width: min(calc(100% - 24px), 420px); transform: translateX(-50%);
  display: grid; gap: 12px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow-lg);
  animation: sheet-in .25s cubic-bezier(.2, 1.2, .4, 1);
}
@media (min-width: 760px) { .map-sheet { bottom: 24px; } }
.map-sheet.is-closing { animation: sheet-out .18s ease-in forwards; }
@keyframes sheet-in { from { opacity: 0; transform: translate(-50%, 30px); } }
@keyframes sheet-out { to { opacity: 0; transform: translate(-50%, 30px); } }
.map-sheet-close { position: absolute; right: 8px; top: 8px; }
.map-sheet-head { display: flex; align-items: center; gap: 12px; padding-right: 36px; }
.map-sheet-head > div { display: grid; }
.map-sheet-head .cat-icon { width: 50px; height: 50px; border-radius: 14px; background: var(--t-soft); display: grid; place-items: center; font-size: 1.6rem; margin: 0; }
.map-sheet-head .muted { font-size: .85rem; }
.map-sheet-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.map-sheet-actions .btn { padding-inline: 6px; font-size: .9rem; }

/* Podsumowanie rozdziału */
.chapter-intro, .chapter-result { position: relative; overflow: hidden; display: grid; gap: 10px; justify-items: start; }
.chapter-result { justify-items: center; text-align: center; }
.chapter-trophy { font-size: 3.2rem; line-height: 1; animation: pop-in-plain .6s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop-in-plain { from { opacity: 0; transform: scale(.3) rotate(-15deg); } }
.chapter-result h1 { font-family: var(--font-display); font-size: 3.4rem; line-height: 1; }
.chapter-msg { max-width: 44ch; font-weight: 600; }
.chapter-cats { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chapter-cats li { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--t-soft); font-size: 1.3rem; }
.chapter-cats li.is-done { box-shadow: inset 0 0 0 2px var(--t); }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti span {
  position: absolute; top: -12px; left: calc(var(--i) * 5.5%); width: 8px; height: 14px; border-radius: 2px;
  background: hsl(calc(var(--i) * 47) 85% 60%);
  animation: confetti 2.6s ease-in forwards; animation-delay: calc(var(--i) * 70ms);
}
@keyframes confetti { to { transform: translateY(520px) rotate(calc(var(--i) * 140deg)); opacity: 0; } }

/* Rzeźby i budowle krain */
.land-sculpts { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.sculpt { position: absolute; width: clamp(78px, 24vw, 104px); filter: drop-shadow(0 6px 6px rgb(40 20 40 / .18)); animation: sculpt-in .7s cubic-bezier(.3, 1.5, .5, 1) both; animation-delay: calc(.2s + var(--k, 0) * .15s); }
.sculpt svg { display: block; width: 100%; height: auto; overflow: visible; }
@keyframes sculpt-in { from { opacity: 0; transform: translateY(16px) scale(.85); } }
.land-sculpts.is-faint .sculpt { opacity: .45; filter: grayscale(.5) blur(1.5px); animation: none; }
.sculpt .anim-spin { transform-box: view-box; transform-origin: 50px 46px; animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sculpt .anim-bob { transform-box: fill-box; animation: bob-plain 3s ease-in-out infinite; }
@keyframes bob-plain { 50% { transform: translateY(-3px) rotate(-2deg); } }
.sculpt .anim-beam { animation: beam 3.2s ease-in-out infinite; }
.sculpt .anim-beam + .anim-beam { animation-delay: -1.6s; }
@keyframes beam { 0%, 100% { opacity: 0; } 40%, 60% { opacity: 1; } }
.sculpt .anim-wave { animation: wave 2.4s ease-in-out infinite; }
@keyframes wave { 50% { transform: translateX(3px); opacity: .6; } }
.sculpt .anim-sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway-plain 4s ease-in-out infinite; }
@keyframes sway-plain { 50% { transform: rotate(-6deg); } }
.sculpt .anim-twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 2.2s ease-in-out infinite; }
.sculpt .anim-twinkle.s2 { animation-delay: -1.1s; }
@keyframes twinkle { 50% { opacity: .2; transform: scale(.5); } }
.sculpt .anim-glow { animation: glow-lava 1.8s ease-in-out infinite; }
@keyframes glow-lava { 50% { opacity: .55; } }
.sculpt .anim-smoke { transform-box: fill-box; transform-origin: center; animation: smoke 3.6s ease-out infinite; }
.sculpt .anim-smoke.s2 { animation-delay: -1.2s; }
.sculpt .anim-smoke.s3 { animation-delay: -2.4s; }
@keyframes smoke { from { opacity: .9; transform: translateY(0) scale(.6); } to { opacity: 0; transform: translateY(-34px) scale(1.6); } }
.sculpt .anim-flag { transform-box: fill-box; transform-origin: 0 50%; animation: flag 1.6s ease-in-out infinite; }
@keyframes flag { 50% { transform: scaleX(.75) skewY(6deg); } }

/* Faktura terenu każdej krainy */
.land-ground::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .9; }
.land.tier-1 .land-ground::after { /* trawa i kwiatki */
  background:
    radial-gradient(circle, #fff7 1.6px, transparent 2.2px) 0 0 / 34px 34px,
    radial-gradient(circle, #ffd35acc 2.2px, transparent 2.8px) 17px 17px / 46px 46px,
    radial-gradient(circle, #ff8fb1cc 2px, transparent 2.6px) 8px 30px / 58px 52px;
}
.land.tier-2 .land-ground { box-shadow: inset 0 0 0 10px #f4e3b0, inset 0 -10px 0 rgb(0 0 0 / .08), 0 18px 30px rgb(60 20 60 / .18); }
.land.tier-2 .land-ground::after { /* fale */
  background: radial-gradient(ellipse 12px 3px at 50% 50%, #fff9 60%, transparent 70%) 0 0 / 64px 44px;
  animation: water 6s linear infinite;
}
@keyframes water { to { background-position: 64px 0; } }
.land.tier-3 .land-ground::after { /* wydmy */
  background: repeating-linear-gradient(168deg, transparent 0 26px, rgb(255 255 255 / .22) 26px 30px, transparent 30px 52px, rgb(160 100 30 / .12) 52px 55px);
}
.land.tier-4 .land-ground::after { /* pęknięcia z lawą */
  background:
    repeating-linear-gradient(58deg, transparent 0 46px, rgb(255 200 60 / .55) 46px 48px, transparent 48px 120px),
    repeating-linear-gradient(-34deg, transparent 0 70px, rgb(255 120 30 / .45) 70px 72px, transparent 72px 150px);
  animation: glow-lava 3s ease-in-out infinite;
}
.land.tier-5 .land-ground::after { /* śnieg i iskierki */
  background:
    radial-gradient(circle, #fff 1.3px, transparent 1.9px) 0 0 / 30px 30px,
    radial-gradient(circle, #fff9 1px, transparent 1.6px) 15px 12px / 22px 26px;
  animation: twinkle-bg 3s ease-in-out infinite;
}
.land.tier-5 .land-ground { box-shadow: inset 0 14px 0 rgb(255 255 255 / .55), inset 0 -10px 0 rgb(0 0 0 / .08), 0 18px 30px rgb(60 20 60 / .18); }
@keyframes twinkle-bg { 50% { opacity: .45; } }
.land.is-locked .land-ground::after { animation: none; }

@media (prefers-reduced-motion: reduce) {
  .map-world::before, .land-body, .land-decor span, .land-bridge span, .cloud, .road-line, .you-pin,
  .map-node.is-current::after, .lock-icon, .land-badge, .map-spot, .confetti span, .chapter-trophy,
  .sculpt, .sculpt *, .land-ground::after { animation: none !important; }
  .land.is-opening .cloud, .clouds.is-clearing .cloud { opacity: 0; }
}
