[hidden] { display: none !important; }
:root {
  --bg: #F8F9FA;
  --ink: #0F172A;
  --muted: #64748B;
  --line: rgba(226, 232, 240, .8);
  --accent: #6366F1;
  --accent-ink: #4F46E5;
  --accent-soft: #EEF2FF;
  --err: #E11D48;
  --card: #FFFFFF;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, .05);
  --shadow-hi: 0 20px 40px rgba(0, 0, 0, .08);
  --r: 16px;
  --fs: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: 'Varela Round', system-ui, sans-serif; font-size: var(--fs); line-height: 1.5; min-height: 100vh; overflow-x: hidden; }
body.kid { --fs: 19px; }
h1, h2, h3, .brand, .h { font-family: 'Raleway', system-ui, sans-serif; font-weight: 800; letter-spacing: -.02em; margin: 0; }
h1 { font-size: 2rem; line-height: 1.15; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: .4em 0; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
a { color: var(--accent-ink); }

/* Ożywiacze tła */
.blob { position: fixed; border-radius: 50%; filter: blur(70px); opacity: .45; z-index: -1; pointer-events: none; }
.b1 { width: 380px; height: 380px; background: #A5B4FC; top: -120px; right: -100px; }
.b2 { width: 300px; height: 300px; background: #DDD6FE; bottom: -80px; left: -90px; }
.b3 { width: 220px; height: 220px; background: #C7D2FE; top: 40%; left: 55%; opacity: .25; }
body.kid .b1 { background: #FDE68A; } body.kid .b2 { background: #A7F3D0; } body.kid .b3 { background: #FBCFE8; opacity: .4; }
body::before { content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: radial-gradient(rgba(99, 102, 241, .10) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 60%); -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 60%); }
body.calm .blob, body.calm::before { display: none; }

/* Szklany navbar */
.glass { background: rgba(248, 249, 250, .72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); }
.nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-width: 0 0 1px; }
.brand { font-size: 1.5rem; } .brand span { color: var(--accent); }
#tabs { display: flex; gap: 4px; margin-left: auto; }
.tab { border: 0; background: none; font: inherit; color: var(--muted); padding: 8px 14px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.tab.on { color: var(--accent-ink); background: var(--accent-soft); }
.tab i { font-style: normal; }
.who { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .85em; cursor: pointer; }
@media (max-width: 760px) {
  .nav { padding: 10px 16px; backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(248, 249, 250, .94); }
  #tabs { position: fixed; bottom: 0; left: 0; right: 0; justify-content: space-around; margin: 0; padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    background: rgba(248, 249, 250, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .tab { flex-direction: column; gap: 0; font-size: .72rem; padding: 4px 8px; }
  .tab i { font-size: 1.25rem; }
  .who { margin-left: auto; }
  main { padding-bottom: 96px !important; }
}

main { max-width: 860px; margin: 0 auto; padding: 24px 18px 48px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }

/* Karty */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px;
  transition: transform .3s ease, box-shadow .3s ease; }
.card.tap { cursor: pointer; }
@media (hover: hover) { .card.tap:hover { transform: translateY(-6px); box-shadow: var(--shadow-hi); } }
.card.tap:active { transform: scale(.98); }
.stat .n { font-family: 'Raleway'; font-weight: 800; font-size: 2rem; color: var(--ink); line-height: 1; }
.stat .n.acc { color: var(--accent-ink); }

/* Przyciski */
.btn { font: inherit; border: 0; border-radius: 12px; padding: 12px 20px; cursor: pointer; background: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .6); transition: transform .15s ease, box-shadow .2s ease, background .2s; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: var(--accent-ink); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn.big { padding: 16px 24px; font-size: 1.05em; }
.btn:disabled { opacity: .5; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .88em; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip .x { color: var(--muted); }
input, textarea, select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font-size: .85em; color: var(--muted); margin: 10px 0 4px; }

/* Logowanie */
.login { max-width: 420px; margin: 8vh auto; text-align: center; }
.pin { letter-spacing: .6em; text-align: center; font-size: 1.6rem; -webkit-text-security: disc; }
.pin:placeholder-shown { -webkit-text-security: none; }
.who-card { font: inherit; color: var(--ink); cursor: pointer; text-align: center; width: 100%; }
.who-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Rozmowa */
.chatbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.msgs { display: flex; flex-direction: column; gap: 12px; padding-bottom: 140px; }
.msg { max-width: 86%; }
.msg.me { align-self: flex-end; }
.bubble { padding: 12px 16px; border-radius: 18px; }
.msg.ai .bubble { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-bottom-left-radius: 6px; font-size: 1.08em; }
.msg.me .bubble { background: var(--accent-soft); border-bottom-right-radius: 6px; }
.msg .tools { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.mini { border: 0; background: none; font: inherit; font-size: .82em; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.mini:hover { background: var(--accent-soft); color: var(--accent-ink); }
.tr { color: var(--muted); font-size: .9em; margin-top: 6px; }
.idiom-mark { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; }
.fix { margin-top: 6px; font-size: .92em; text-align: right; }
.fix s { color: var(--err); }
.fix b { color: var(--ink); }
.q { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .75em; border: 0; cursor: pointer; vertical-align: middle; margin-left: 4px; }
.why { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-top: 6px; text-align: left; color: var(--ink); animation: slide .25s ease; }
@keyframes slide { from { opacity: 0; transform: translateY(-4px); } }
.newword { font-size: .82em; }
.idiomcard { border-left: 4px solid var(--accent); }
.composer { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); z-index: 15; }
@media (max-width: 760px) { .composer { bottom: 62px; } }
.composer .inner { max-width: 860px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { resize: none; min-height: 48px; max-height: 140px; }
.mic { width: 52px; height: 52px; border-radius: 50%; padding: 0; justify-content: center; flex: none; font-size: 1.3em; }
.mic.rec { background: var(--err); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .5); } 70% { box-shadow: 0 0 0 14px rgba(225, 29, 72, 0); } 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); } }
.typing { color: var(--muted); font-style: italic; }

/* Fiszki */
.flip { perspective: 1000px; height: 260px; cursor: pointer; }
.flip .inner { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.2, .7, .2, 1); transform-style: preserve-3d; }
.flip.on .inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px; }
.face.back { transform: rotateY(180deg); }
.face .t { font-family: 'Raleway'; font-weight: 800; font-size: 1.7rem; }
.progress { height: 6px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.opt { text-align: left; width: 100%; }
.opt.ok { border-color: #10B981; background: #ECFDF5; }
.opt.bad { border-color: var(--err); background: #FFF1F2; }

/* Słowa */
.item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.item .term { font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; background: #CBD5E1; }
.dot.s0, .dot.s1, .dot.s2 { background: #FBBF24; } .dot.s3, .dot.s4, .dot.s5, .dot.s6 { background: #10B981; }
.scroller { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }

/* Arkusz (modal) */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 42, .25); backdrop-filter: blur(4px); display: grid; place-items: end center; }
.sheet .panel { width: 100%; max-width: 560px; background: var(--card); border-radius: 22px 22px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-hi); animation: up .3s ease; max-height: 88vh; overflow: auto; }
@media (min-width: 761px) { .sheet { place-items: center; } .sheet .panel { border-radius: 22px; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 50; font-size: .9em; }
.empty { text-align: center; padding: 40px 10px; }
.hero { padding: 26px; }
.reading-text { white-space: pre-wrap; font-size: 1.05em; }

/* Zdjęcia i kolor */
.banner { position: relative; border-radius: 20px; min-height: 150px; background-size: cover; background-position: center; display: flex; align-items: flex-end; overflow: hidden; box-shadow: var(--shadow); }
.banner.tall { min-height: 220px; }
.banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,23,42,0) 30%, rgba(15,23,42,.7)); }
.banner > div { position: relative; z-index: 1; padding: 18px 20px; color: #fff; text-align: left; }
.banner h1 { color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.3); }
.banner p { margin: 2px 0 0; opacity: .9; }
.hero.photo { background-size: cover; background-position: center; color: #fff; border: 0; min-height: 280px; display: flex; flex-direction: column; justify-content: flex-end; }
.hero.photo h1 { color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.35); }
.hero.photo .progress { background: rgba(255,255,255,.3); }
.hero.photo .progress > div { background: #fff; }
.hero.photo .btn.ghost { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.4); backdrop-filter: blur(6px); }
.hero.photo .btn:not(.ghost) { background: #fff; color: var(--accent-ink); box-shadow: 0 10px 24px -8px rgba(0,0,0,.4); }
.stat.c1 { background: linear-gradient(135deg, #EEF2FF, #E0E7FF); border-color: #C7D2FE; }
.stat.c2 { background: linear-gradient(135deg, #ECFDF5, #D1FAE5); border-color: #A7F3D0; }
.stat.c2 .n { color: #047857; }
.stat.c3 { background: linear-gradient(135deg, #FFF7ED, #FFEDD5); border-color: #FED7AA; }
.stat.c3 .n { color: #C2410C; }
.stat.c4 { background: linear-gradient(135deg, #F0F9FF, #E0F2FE); border-color: #BAE6FD; }
.stat.c4 .n { color: #0369A1; }
.idiomcard.tap { background: linear-gradient(135deg, #F5F3FF, #EEF2FF); }
.msg.me .bubble { background: linear-gradient(135deg, #EEF2FF, #E0E7FF); }
.chip.on { background: linear-gradient(135deg, #6366F1, #8B5CF6); }
.flip .face.back { background: linear-gradient(135deg, #F5F3FF, #EEF2FF); }
body.kid .stat.c1 { background: linear-gradient(135deg, #FEF3C7, #FDE68A); }
body.kid .hero.photo .btn:not(.ghost) { color: #B45309; }
select { appearance: auto; }

.fix.praise { color: #047857; }
.fix.sayit { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; text-align: left; margin-top: 8px; box-shadow: var(--shadow); }

.source { text-align: left; display: block; }
.source .ico { font-size: 1.8rem; line-height: 1; margin-bottom: 8px; }
.source.c1 { background: linear-gradient(135deg, #EEF2FF, #E0E7FF); border-color: #C7D2FE; }
.source.c2 { background: linear-gradient(135deg, #ECFDF5, #D1FAE5); border-color: #A7F3D0; }
.source.c3 { background: linear-gradient(135deg, #FFF7ED, #FFEDD5); border-color: #FED7AA; }
.podcard { background-size: cover; background-position: center; color: #fff; border: 0; min-height: 130px; display: flex; flex-direction: column; justify-content: flex-end; }
.podcard h3 { color: #fff; }
.player { position: sticky; top: 64px; z-index: 5; }
.seg { cursor: pointer; border-radius: 6px; transition: background .2s; line-height: 1.8; }
.seg:hover { background: var(--accent-soft); }
.seg.on { background: #E0E7FF; color: var(--accent-ink); }
.para + .para { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.para .tools { display: flex; gap: 6px; }
