/* ============================================================
   Lekturomania — Style
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --blue:#3A86FF; --blue2:#2563EB; --blue-bg:#EEF4FF;
  --coral:#FF6B6B; --coral2:#E85555; --coral-bg:#FFF0F0;
  --mint:#06D6A0; --mint-bg:#E6FBF5;
  --gold:#F59E0B; --gold-bg:#FFFBEB;
  --purple:#7C3AED; --purple-bg:#F5F3FF;
  --pink:#F472B6;
  --ink:#0F172A; --ink2:#334155; --ink3:#64748B; --ink4:#94A3B8;
  --surface:#FFFFFF; --surface2:#F4F7FE; --surface3:#E9EEF9;
  --border:#E2E8F0; --border2:#CBD5E1;
  --shadow-sm:0 1px 3px rgba(15,23,42,.08);
  --shadow:0 6px 18px rgba(15,23,42,.08);
  --shadow-lg:0 16px 48px rgba(15,23,42,.14);
  --r:14px; --rlg:22px; --rxl:30px;
  --font:'Plus Jakarta Sans', system-ui, sans-serif;
  --display:'Baloo 2', system-ui, sans-serif;
}

body.dark {
  --ink:#F1F5F9; --ink2:#CBD5E1; --ink3:#94A3B8; --ink4:#64748B;
  --surface:#16203A; --surface2:#0E1626; --surface3:#1E293B;
  --border:#28344f; --border2:#3a4a6b;
  --blue-bg:#16294d; --coral-bg:#3a1f24; --mint-bg:#0f2e28;
  --gold-bg:#33270f; --purple-bg:#241a3f;
  --shadow:0 6px 18px rgba(0,0,0,.4);
  --shadow-lg:0 16px 48px rgba(0,0,0,.5);
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 80% -10%, var(--purple-bg), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, var(--blue-bg), transparent 55%),
    var(--surface2);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .display { font-family: var(--display); letter-spacing: -.5px; }

/* ---------- HEADER ---------- */
header {
  position: sticky; top: 0; z-index: 100;
  height: 62px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(16px, 4vw);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-family: var(--display); font-size: 22px; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(110deg, var(--blue), var(--purple), var(--coral));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.logo .logo-mark { -webkit-text-fill-color: initial; }
.header-right { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 19px;
  display: flex; align-items: center; justify-content: center; transition: .18s;
  color: var(--ink);
}
.icon-btn:hover { border-color: var(--blue); background: var(--blue-bg); transform: translateY(-1px); }
.icon-btn:active { transform: scale(.92); }

/* mini-pasek XP w nagłówku */
.header-xp { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.header-xp .avatar-mini {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-size: 21px; background: var(--surface3); border: 2px solid var(--border);
}
.header-xp .xp-mini { display: none; flex-direction: column; gap: 3px; min-width: 110px; }
@media(min-width: 560px){ .header-xp .xp-mini { display: flex; } }
.xp-mini .xp-mini-top { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; color: var(--ink3); }
.xp-mini .bar { height: 6px; border-radius: 4px; background: var(--surface3); overflow: hidden; }
.xp-mini .bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--purple)); border-radius: 4px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.streak-chip {
  display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 14px;
  padding: 7px 11px; border-radius: 12px; background: var(--gold-bg); color: #B45309;
}
body.dark .streak-chip { color: #FCD34D; }

/* ---------- LAYOUT ---------- */
main { padding: 22px max(16px, 4vw) 90px; max-width: 1180px; margin: 0 auto; }
.section { display: none; animation: pop .35s cubic-bezier(.2,.8,.2,1); }
.section.active { display: block; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- BUTTONS ---------- */
.btn {
  font-family: var(--display); font-weight: 700; font-size: 16px; cursor: pointer;
  padding: 14px 26px; border-radius: var(--rlg); border: none; transition: .18s;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(120deg, var(--blue), var(--purple)); color: #fff; box-shadow: 0 8px 22px rgba(58,134,255,.4); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(124,58,237,.45); }
.btn-coral { background: linear-gradient(120deg, var(--coral), var(--pink)); color: #fff; box-shadow: 0 8px 22px rgba(255,107,107,.4); }
.btn-coral:hover { transform: translateY(-2px); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border2); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-lg { font-size: 18px; padding: 16px 32px; }
.btn-block { width: 100%; }

/* ---------- ONBOARDING ---------- */
.onboard { max-width: 540px; margin: 4vh auto 0; text-align: center; }
.onboard .mascot-big { font-size: 84px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-12px) } }
.onboard h1 { font-size: clamp(30px, 6vw, 46px); margin: 6px 0 8px; }
.onboard p { color: var(--ink2); font-size: 16px; margin-bottom: 22px; line-height: 1.5; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--rxl);
  padding: 26px; box-shadow: var(--shadow); text-align: left;
}
.field-label { font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--ink2); margin-bottom: 10px; display: block; }
.text-input {
  width: 100%; padding: 14px 16px; font-family: var(--font); font-size: 16px; color: var(--ink);
  border: 1.5px solid var(--border2); border-radius: var(--r); background: var(--surface2); outline: none; transition: .18s;
}
.text-input:focus { border-color: var(--blue); background: var(--surface); box-shadow: 0 0 0 4px var(--blue-bg); }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 22px; }
.avatar-opt {
  aspect-ratio: 1; border-radius: 16px; border: 2px solid var(--border); background: var(--surface2);
  font-size: 30px; cursor: pointer; transition: .15s; display: grid; place-items: center;
}
.avatar-opt:hover { transform: translateY(-3px) scale(1.05); border-color: var(--blue); }
.avatar-opt.sel { border-color: var(--blue); background: var(--blue-bg); box-shadow: 0 0 0 4px var(--blue-bg); transform: scale(1.05); }

/* ---------- HOME / DASHBOARD ---------- */
.hero-card {
  position: relative; overflow: hidden;
  background: linear-gradient(125deg, var(--blue), var(--purple) 70%, var(--coral));
  color: #fff; border-radius: var(--rxl); padding: 24px; box-shadow: var(--shadow-lg);
}
.hero-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; background: radial-gradient(circle, rgba(255,255,255,.25), transparent 70%); }
.hero-card::before { content: ""; position: absolute; left: -50px; bottom: -60px; width: 200px; height: 200px; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); pointer-events: none; }
.hero-top { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; }
.hero-avatar { width: 70px; height: 70px; border-radius: 22px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 40px; flex-shrink: 0; animation: float 3.5s ease-in-out infinite; }
.hero-hi { font-family: var(--display); font-size: clamp(22px, 5vw, 30px); font-weight: 800; line-height: 1.1; }
.hero-level { font-size: 14px; opacity: .92; margin-top: 4px; font-weight: 600; }
.hero-xpbar { margin-top: 18px; position: relative; z-index: 1; }
.hero-xpbar .labels { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; opacity: .92; margin-bottom: 6px; }
.hero-xpbar .bar { height: 12px; border-radius: 8px; background: rgba(255,255,255,.25); overflow: hidden; }
.hero-xpbar .bar > i { display: block; height: 100%; border-radius: 8px; background: #fff; transition: width .7s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 12px rgba(255,255,255,.6); }

.quick-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.qstat {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--rlg); padding: 18px 12px 14px; text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s;
}
/* kolorowy pasek na górze + miękka poświata w rogu — każda karta w swoim kolorze */
.qstat::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; }
.qstat::after  { content: ""; position: absolute; top: -32px; right: -32px; width: 92px; height: 92px; border-radius: 50%; opacity: .14; filter: blur(2px); }
.qstat:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.qstat:nth-child(1)::before { background: linear-gradient(90deg, var(--gold), var(--coral)); }
.qstat:nth-child(1)::after  { background: var(--gold); }
.qstat:nth-child(1):hover   { border-color: var(--gold); }
.qstat:nth-child(2)::before { background: linear-gradient(90deg, var(--blue), var(--mint)); }
.qstat:nth-child(2)::after  { background: var(--blue); }
.qstat:nth-child(2):hover   { border-color: var(--blue); }
.qstat:nth-child(3)::before { background: linear-gradient(90deg, var(--purple), var(--pink)); }
.qstat:nth-child(3)::after  { background: var(--purple); }
.qstat:nth-child(3):hover   { border-color: var(--purple); }
.qstat .v { font-family: var(--display); font-size: 30px; font-weight: 800; line-height: 1; position: relative; z-index: 1; }
.qstat .v.flame { color: var(--gold); } .qstat .v.book { color: var(--blue); } .qstat .v.star { color: var(--purple); }
.qstat .l { font-size: 11px; color: var(--ink3); font-weight: 700; margin-top: 8px; text-transform: uppercase; letter-spacing: .04em; position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .qstat { transition: none; } .qstat:hover { transform: none; } }

/* Główny przycisk akcji na ekranie głównym — ma wyraźnie przyciągać wzrok
   i odróżniać się od niebiesko-fioletowej karty hero powyżej. */
.home-cta {
  margin: 24px 0 10px;
  font-size: 20px;
  padding: 20px 30px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(120,40,0,.25);
  background: linear-gradient(120deg, var(--gold), var(--coral) 52%, var(--pink));
  box-shadow: 0 12px 30px rgba(245,158,11,.42), 0 4px 14px rgba(255,107,107,.32);
  animation: ctaPulse 2.6s ease-in-out infinite;
}
.home-cta .cta-ico { font-size: 24px; line-height: 1; }
.home-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(245,158,11,.52), 0 6px 18px rgba(255,107,107,.42);
}
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 12px 30px rgba(245,158,11,.42), 0 0 0 0 rgba(245,158,11,.42); }
  50%      { box-shadow: 0 12px 30px rgba(245,158,11,.42), 0 0 0 12px rgba(245,158,11,0); }
}
@media (prefers-reduced-motion: reduce) {
  .home-cta { animation: none; }
}

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 14px; }
.section-head h2 { font-size: 22px; }
.link-btn { background: none; border: none; color: var(--blue); font-weight: 700; font-family: var(--display); font-size: 14px; cursor: pointer; }

/* badges preview row */
.badge-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; }
.badge-chip { flex: 0 0 auto; width: 64px; text-align: center; }
.badge-chip .b-ico { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 28px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.badge-chip.locked .b-ico { filter: grayscale(1); opacity: .35; }
.badge-chip.earned .b-ico { background: var(--gold-bg); border-color: var(--gold); animation: badgePulse .6s ease; }
.badge-chip .b-name { font-size: 10px; font-weight: 700; color: var(--ink3); margin-top: 5px; line-height: 1.2; }
@keyframes badgePulse { 0%{transform:scale(.6);opacity:0} 60%{transform:scale(1.15)} 100%{transform:scale(1);opacity:1} }

/* ---------- FILTERS ---------- */
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.search-wrap { position: relative; }
.search-wrap input { width: 100%; padding: 13px 16px 13px 44px; font-family: var(--font); font-size: 15px; color: var(--ink); border: 1.5px solid var(--border2); border-radius: var(--rlg); background: var(--surface); outline: none; transition: .18s; }
.search-wrap input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-bg); }
.search-wrap .s-ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); font-size: 17px; opacity: .6; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
  flex: 0 0 auto; padding: 9px 15px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface); font-family: var(--display); font-weight: 700; font-size: 14px; color: var(--ink2);
  cursor: pointer; transition: .15s; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.chip:hover { border-color: var(--blue); }
.chip.active { color: #fff; border-color: transparent; background: linear-gradient(120deg, var(--blue), var(--purple)); box-shadow: 0 6px 14px rgba(58,134,255,.35); }

/* ---------- BOOK GRID ---------- */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
@media(min-width: 700px){ .books-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
.book-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--rlg); overflow: hidden; cursor: pointer; transition: .22s; box-shadow: var(--shadow-sm); position: relative; text-align: left; padding: 0; font-family: var(--font); }
.book-card:hover { transform: translateY(-6px) rotate(-.4deg); box-shadow: var(--shadow-lg); }
.book-card:active { transform: scale(.97); }
.book-cover { height: 124px; display: grid; place-items: center; position: relative; overflow: hidden; }
/* warstwa dekoracyjna: światło od góry + delikatny wzór ukośnych pasków */
.book-cover::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(130px 90px at 22% 16%, rgba(255,255,255,.40), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.07) 0 11px, transparent 11px 22px);
}
/* winieta na dole dla czytelności tagów */
.book-cover::after { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(180deg, transparent 52%, rgba(0,0,0,.18)); }
/* medalion z emoji — efekt naklejki/odznaki */
.book-emoji {
  position: relative; z-index: 1;
  width: 74px; height: 74px; border-radius: 50%;
  display: grid; place-items: center; font-size: 40px; line-height: 1;
  background: radial-gradient(circle at 36% 28%, #ffffff, rgba(255,255,255,.72));
  box-shadow: 0 7px 18px rgba(0,0,0,.22), inset 0 2px 5px rgba(255,255,255,.95), inset 0 -3px 7px rgba(0,0,0,.06);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.18));
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.book-card:hover .book-emoji { transform: translateY(-3px) scale(1.09) rotate(-3deg); box-shadow: 0 11px 24px rgba(0,0,0,.28), inset 0 2px 5px rgba(255,255,255,.95), inset 0 -3px 7px rgba(0,0,0,.06); }
/* świetlisty pierścień wokół medalionu — pojawia się przy najechaniu */
.book-emoji::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); opacity: 0; transform: scale(.78); transition: opacity .25s, transform .25s cubic-bezier(.2,.8,.2,1); }
.book-card:hover .book-emoji::after { opacity: 1; transform: scale(1); }
@media (prefers-reduced-motion: reduce) { .book-card:hover .book-emoji { transform: none; } .book-emoji::after { display: none; } }
.book-cover .ready-dot { position: absolute; top: 9px; right: 9px; background: var(--mint); color: #053; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.book-cover .soon-dot { position: absolute; top: 9px; right: 9px; background: rgba(255,255,255,.9); color: #64748b; font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
/* Lektury bez pytań — wyszarzone, ale wciąż dostępne (pokażą ekran „wkrótce"). */
.book-card.not-ready { opacity: .55; filter: grayscale(.85); }
.book-card.not-ready:hover { opacity: .82; filter: grayscale(.4); transform: translateY(-3px); }
.book-card.not-ready .book-emoji { box-shadow: none; }
.book-cover .klasa-tag { position: absolute; top: 9px; left: 9px; background: rgba(255,255,255,.92); color: #1e293b; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; z-index: 2; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.book-info { padding: 12px 13px 14px; }
.book-title { font-family: var(--display); font-size: 14px; font-weight: 700; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px; }
.book-author { font-size: 11px; color: var(--ink3); margin-top: 3px; }
.book-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }
.type-badge { font-size: 9px; font-weight: 800; padding: 3px 7px; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; background: var(--gold-bg); color: #92400E; }
.type-badge.ob { background: #DCFCE7; color: #166534; }
body.dark .type-badge.ob { background:#0f3a24; color:#86efac; }
body.dark .type-badge { background:#3a2f0f; color:#fcd34d; }
.book-progress { font-size: 11px; font-weight: 800; color: var(--mint); }
.empty-state { text-align: center; color: var(--ink3); padding: 50px 20px; }
.empty-state .e-ico { font-size: 50px; }

/* ---------- QUIZ SETUP ---------- */
.setup-wrap { max-width: 560px; margin: 0 auto; }
.setup-book { display: flex; gap: 16px; align-items: center; margin-bottom: 22px; }
.setup-book .cov { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; font-size: 42px; flex-shrink: 0; box-shadow: var(--shadow), inset 0 2px 6px rgba(255,255,255,.45), inset 0 -5px 12px rgba(0,0,0,.10); text-shadow: 0 2px 5px rgba(0,0,0,.20); }
.setup-book h2 { font-size: 22px; line-height: 1.1; }
.setup-book .a { color: var(--ink3); font-size: 14px; margin-top: 3px; }
.diff-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.diff-btn { padding: 16px 10px; border: 2px solid var(--border); border-radius: var(--rlg); background: var(--surface); cursor: pointer; transition: .15s; text-align: center; font-family: var(--display); }
.diff-btn:hover { transform: translateY(-2px); border-color: var(--blue); }
.diff-btn .d-emoji { font-size: 26px; } .diff-btn .d-name { font-weight: 700; font-size: 14px; margin-top: 4px; } .diff-btn .d-count { font-size: 11px; color: var(--ink3); margin-top: 2px; }
.diff-btn.active.easy { border-color: var(--mint); background: var(--mint-bg); }
.diff-btn.active.medium { border-color: var(--gold); background: var(--gold-bg); }
.diff-btn.active.hard { border-color: var(--coral); background: var(--coral-bg); }
.diff-btn.disabled { opacity: .4; pointer-events: none; }
.count-box { display: flex; align-items: center; justify-content: space-between; background: var(--surface2); border-radius: var(--r); padding: 10px 16px; margin-top: 10px; }
.count-box .big { font-family: var(--display); font-size: 28px; font-weight: 800; color: var(--blue); }
input[type="range"] { width: 100%; height: 8px; border-radius: 5px; background: var(--surface3); outline: none; -webkit-appearance: none; appearance: none; margin-top: 12px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: var(--blue); cursor: pointer; box-shadow: 0 2px 10px rgba(58,134,255,.5); border: 3px solid #fff; }
input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); cursor: pointer; border: 3px solid #fff; }

/* ---------- QUIZ ---------- */
.quiz-wrap { max-width: 640px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.quiz-top .q-counter { font-family: var(--display); font-weight: 800; font-size: 15px; color: var(--ink3); white-space: nowrap; }
.qbar { flex: 1; height: 12px; border-radius: 8px; background: var(--surface3); overflow: hidden; }
.qbar > i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--mint), var(--blue)); transition: width .4s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 10px color-mix(in srgb, var(--blue) 55%, transparent); }
.q-retry-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--gold); background: var(--gold-bg); padding: 5px 10px; border-radius: 999px; margin-bottom: 12px; }

/* Lektor (TTS) */
.tts-toggle {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 18px; line-height: 1; display: grid; place-items: center; transition: .15s;
}
.tts-toggle:hover { border-color: var(--blue); background: var(--blue-bg); }
.tts-toggle.on { border-color: var(--mint); background: var(--mint-bg); }
.q-text-row { display: flex; align-items: flex-start; gap: 10px; }
.q-text-row .question { flex: 1; }
.tts-btn {
  flex-shrink: 0; border: 2px solid var(--border); background: var(--surface); color: var(--ink2);
  border-radius: 12px; cursor: pointer; font-family: var(--font); font-weight: 700; transition: .15s;
}
.q-text-row .tts-btn { width: 38px; height: 38px; font-size: 18px; margin-top: 6px; display: grid; place-items: center; }
.tts-btn:hover { border-color: var(--blue); background: var(--blue-bg); color: var(--blue); }
.tts-btn-inline { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 8px 14px; font-size: 13.5px; }

.question { font-family: var(--display); font-size: clamp(19px, 3.5vw, 24px); font-weight: 700; line-height: 1.35; margin: 8px 0 20px; }
.options { display: flex; flex-direction: column; gap: 11px; }
.option {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 15px 16px; border: 2px solid var(--border); border-radius: var(--rlg); background: var(--surface);
  font-family: var(--font); font-size: 15.5px; font-weight: 500; color: var(--ink); cursor: pointer; transition: .15s;
}
.option:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-bg); transform: translateX(3px); box-shadow: var(--shadow-sm); }
.option:hover:not(:disabled) .letter { background: var(--blue); color: #fff; }
.option:disabled { cursor: default; }
.option .letter { width: 32px; height: 32px; border-radius: 10px; background: var(--surface3); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 14px; color: var(--ink3); flex-shrink: 0; transition: .15s; }
.option.correct { border-color: var(--mint); background: var(--mint-bg); color: #065F46; }
.option.correct .letter { background: var(--mint); color: #fff; }
.option.wrong { border-color: var(--coral); background: var(--coral-bg); color: #991B1B; animation: shake .4s; }
.option.wrong .letter { background: var(--coral); color: #fff; }
body.dark .option.correct { color:#6ee7b7; } body.dark .option.wrong { color:#fca5a5; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-7px)} 75%{transform:translateX(7px)} }
.explain { margin-top: 16px; padding: 14px 16px; border-radius: var(--rlg); font-size: 14px; line-height: 1.55; display: none; animation: pop .3s; }
.explain.show { display: block; }
.explain.ok { background: var(--mint-bg); border: 1px solid color-mix(in srgb, var(--mint) 40%, transparent); color: #065F46; }
.explain.no { background: var(--coral-bg); border: 1px solid color-mix(in srgb, var(--coral) 40%, transparent); color: #991B1B; }
body.dark .explain.ok { color:#a7f3d0; } body.dark .explain.no { color:#fecaca; }
.explain .e-head { font-family: var(--display); font-weight: 800; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }

/* latający +XP */
.xp-pop { position: fixed; font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--gold); pointer-events: none; z-index: 9998; text-shadow: 0 2px 8px rgba(0,0,0,.15); animation: xpfloat 1s ease-out forwards; }
@keyframes xpfloat { 0%{opacity:0; transform: translateY(0) scale(.5)} 20%{opacity:1; transform: translateY(-10px) scale(1.1)} 100%{opacity:0; transform: translateY(-70px) scale(1)} }

/* ---------- RESULTS ---------- */
.results-wrap { max-width: 520px; margin: 0 auto; text-align: center; }
.result-emoji { font-size: 80px; animation: float 3s ease-in-out infinite; }
.score-ring { width: 150px; height: 150px; margin: 8px auto 18px; border-radius: 50%; display: grid; place-items: center; position: relative; box-shadow: 0 12px 32px rgba(15,23,42,.14); animation: ringIn .6s cubic-bezier(.2,.8,.2,1); }
.score-ring .inner { width: 120px; height: 120px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; flex-direction: column; box-shadow: inset 0 2px 8px rgba(15,23,42,.06); }
@keyframes ringIn { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .score-ring { animation: none; } }
.score-ring .pct { font-family: var(--display); font-size: 40px; font-weight: 800; line-height: 1; }
.score-ring .lbl { font-size: 11px; color: var(--ink3); font-weight: 700; }
.result-title { font-size: 28px; margin-bottom: 6px; }
.result-msg { color: var(--ink2); font-size: 15px; line-height: 1.5; margin-bottom: 18px; }
.xp-gain { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 800; font-size: 20px; color: var(--gold); background: var(--gold-bg); padding: 10px 20px; border-radius: 999px; margin-bottom: 18px; }
.levelup-banner { background: linear-gradient(120deg, var(--purple), var(--blue)); color: #fff; border-radius: var(--rlg); padding: 16px; margin-bottom: 16px; font-family: var(--display); font-weight: 800; animation: pop .5s; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.result-stats .rs {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--rlg);
  padding: 16px 6px 13px; box-shadow: var(--shadow-sm);
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
}
.result-stats .rs::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; }
.result-stats .rs:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
/* zielony = za 1. razem, czerwony = pomyłki, niebieski = opanowane */
.result-stats .rs:nth-child(1)::before { background: var(--mint); }
.result-stats .rs:nth-child(1) .v { color: var(--mint); }
.result-stats .rs:nth-child(2)::before { background: var(--coral); }
.result-stats .rs:nth-child(2) .v { color: var(--coral); }
.result-stats .rs:nth-child(3)::before { background: var(--blue); }
.result-stats .rs:nth-child(3) .v { color: var(--blue); }
.result-stats .rs .v { font-family: var(--display); font-size: 24px; font-weight: 800; } .result-stats .rs .l { font-size: 11px; color: var(--ink3); font-weight: 700; margin-top: 3px; }
@media (prefers-reduced-motion: reduce) { .result-stats .rs { transition: none; } .result-stats .rs:hover { transform: none; } }
.new-badges { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.new-badge { background: var(--gold-bg); border: 2px solid var(--gold); border-radius: var(--rlg); padding: 12px 16px; text-align: center; animation: badgePulse .6s; }
.new-badge .nb-ico { font-size: 34px; } .new-badge .nb-name { font-family: var(--display); font-weight: 800; font-size: 13px; margin-top: 4px; } .new-badge .nb-tag { font-size: 10px; color: var(--gold); font-weight: 700; }
.results-buttons { display: flex; flex-direction: column; gap: 10px; }

/* ---------- PROFILE ---------- */
.profile-head { text-align: center; margin-bottom: 22px; }
.profile-head .p-avatar { width: 96px; height: 96px; border-radius: 30px; background: linear-gradient(120deg, var(--blue), var(--purple)); display: grid; place-items: center; font-size: 54px; margin: 0 auto 10px; box-shadow: var(--shadow-lg); cursor: pointer; }
.profile-head h2 { font-size: 26px; } .profile-head .p-lvl { color: var(--ink3); font-weight: 600; margin-top: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
@media(min-width:560px){ .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.badges-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.gal-badge { background: var(--surface); border: 1px solid var(--border); border-radius: var(--rlg); padding: 14px 8px; text-align: center; box-shadow: var(--shadow-sm); }
.gal-badge.locked { opacity: .45; filter: grayscale(.8); }
.gal-badge .g-ico { font-size: 34px; } .gal-badge .g-name { font-family: var(--display); font-weight: 700; font-size: 12px; margin-top: 6px; } .gal-badge .g-desc { font-size: 10px; color: var(--ink3); margin-top: 3px; line-height: 1.3; }
.gal-badge.earned { border-color: var(--gold); background: var(--gold-bg); }

/* ---------- PROFILE PICKER (wiele profili) ---------- */
.profiles-pick { max-width: 640px; margin: 4vh auto 0; text-align: center; }
.profiles-pick h1 { font-size: clamp(28px, 6vw, 42px); margin: 6px 0 8px; }
.profiles-pick p { color: var(--ink2); font-size: 15px; margin-bottom: 26px; line-height: 1.5; }
.profiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.profile-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--rxl);
  padding: 22px 14px 18px; cursor: pointer; transition: .2s; box-shadow: var(--shadow-sm);
  font-family: var(--font); display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.profile-card:hover { transform: translateY(-5px); border-color: var(--blue); box-shadow: var(--shadow-lg); }
.profile-card:active { transform: scale(.96); }
.profile-card .pc-av {
  width: 78px; height: 78px; border-radius: 26px; display: grid; place-items: center; font-size: 44px;
  background: linear-gradient(120deg, var(--blue), var(--purple)); box-shadow: var(--shadow); color: #fff;
}
.profile-card .pc-name { font-family: var(--display); font-weight: 800; font-size: 18px; margin-top: 8px; }
.profile-card .pc-lvl { font-size: 12px; color: var(--ink3); font-weight: 600; }
.profile-card.add { border-style: dashed; justify-content: center; min-height: 160px; color: var(--ink3); }
.profile-card.add .pc-av { background: var(--surface3); color: var(--ink3); }
.profile-card.add:hover { color: var(--blue); }

/* ---------- TRYB NAUKI ---------- */
.learn-tag {
  display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; line-height: 1.4;
  color: var(--purple); background: var(--purple-bg); padding: 9px 14px; border-radius: var(--rlg); margin-bottom: 14px;
}
body.dark .learn-tag { color: #c4b5fd; }
.learn-nav { display: flex; gap: 10px; margin-top: 18px; }
.learn-nav .btn { flex: 1; }
.option.dim { opacity: .6; }

/* ---------- MODAL ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(4px); z-index: 500; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-bg.show { display: flex; animation: pop .25s; }
.modal { background: var(--surface); border-radius: var(--rxl); padding: 26px; max-width: 420px; width: 100%; box-shadow: var(--shadow-lg); }
.modal h3 { font-size: 22px; margin-bottom: 6px; } .modal p { color: var(--ink2); font-size: 14px; line-height: 1.5; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; }

/* ---------- FOOTER ---------- */
footer { text-align: center; padding: 30px 20px 40px; color: var(--ink3); font-size: 12px; line-height: 1.7; }
footer strong { color: var(--ink2); }

/* dostępność: wyraźny focus */
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
