/* © 2026 Karol Weiher. Kurs niemieckiego dla Alicji. */
:root {
  --bg: #f6f1e7; --card: #fffdf8; --line: #e2d8c6; --text: #2b2622; --muted: #6b6259;
  --green: #2f6b4f; --green-soft: #e3efe7; --red: #b5523b; --red-soft: #f6e2dc;
  --amber: #c98a1d; --amber-soft: #f7ecd4; --blue-soft: #e6eef7;
  --shadow: 0 1px 3px rgba(60, 45, 30, .12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1916; --card: #26231f; --line: #3b362f; --text: #f1ece4; --muted: #b9b0a4;
    --green: #6cbf93; --green-soft: #22382c; --red: #e3866f; --red-soft: #402822;
    --amber: #e6b04f; --amber-soft: #3d321d; --blue-soft: #222e3b;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
.app {
  max-width: 560px; margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
h1 { font-size: 1.5rem; margin: .4em 0; }
h2 { font-size: 1.25rem; margin: 1.2em 0 .5em; }
h3 { font-size: 1.08rem; margin: 0 0 .3em; }
p { margin: .5em 0; }
.muted, .hint, .src { color: var(--muted); }
.hint, .src { font-size: .95rem; }
.loading { text-align: center; margin-top: 40vh; color: var(--muted); }

/* przyciski: min. 48 px wysokości */
button { font: inherit; color: inherit; }
.btn {
  display: block; width: 100%; min-height: 52px; margin: 10px 0 0; padding: 12px 16px;
  border: 2px solid var(--green); border-radius: 14px; background: var(--card); color: var(--green);
  font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--green); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #10231a; } }
.btn.ghost { border-color: var(--line); color: var(--text); font-weight: 500; }
.btn:disabled { opacity: .45; cursor: default; }
.link {
  background: none; border: 0; padding: 12px 0; min-height: 48px; color: var(--muted);
  text-decoration: underline; cursor: pointer;
}
.mini {
  min-width: 48px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); cursor: pointer; font-size: .95rem;
}
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }
.row-wrap { flex-direction: row; flex-wrap: wrap; }

/* ekran główny */
.hero { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.hero-img { width: 96px; height: 96px; flex: none; }
.greet { font-size: 1.15rem; font-weight: 600; margin: 0; }
.stats { display: flex; gap: 8px; margin-bottom: 6px; }
.stat {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 8px; text-align: center; box-shadow: var(--shadow);
}
.stat b { display: block; font-size: 1.4rem; color: var(--green); }
.stat span { font-size: .85rem; color: var(--muted); line-height: 1.2; display: block; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin: 12px 0; box-shadow: var(--shadow);
}
.plan .status { font-weight: 700; margin-bottom: 0; }
.status.ahead, .status.ok { color: var(--green); }
.status.behind { color: var(--amber); }
.ep {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; margin: 10px 0; box-shadow: var(--shadow);
}
.ep-head { display: flex; gap: 12px; align-items: flex-start; }
.ep-head img { width: 84px; flex: none; border-radius: 10px; }
.ep-head p { margin: .2em 0; font-size: .95rem; }
.badge {
  display: inline-block; background: var(--green-soft); color: var(--green);
  border-radius: 999px; padding: 2px 10px; font-size: .85rem; font-weight: 600;
}
.lessons { list-style: none; padding: 0; margin: 10px 0 0; }
.lrow {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px;
  padding: 8px 4px; background: none; border: 0; border-top: 1px solid var(--line);
  text-align: left; cursor: pointer;
}
.chk {
  width: 26px; height: 26px; flex: none; border: 2px solid var(--line); border-radius: 50%;
  display: grid; place-items: center; font-size: .85rem; color: #fff;
}
.lrow.done .chk { background: var(--green); border-color: var(--green); }
.foot { text-align: center; margin-top: 18px; }

/* przebieg */
.runtop { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; background: var(--bg); padding: 6px 0 10px; z-index: 2; }
.x { min-width: 48px; min-height: 48px; border: 0; background: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
.bar { flex: 1; height: 12px; border-radius: 6px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--green); border-radius: 6px; transition: width .35s ease; }
.combo { min-width: 64px; text-align: right; font-weight: 700; color: var(--amber); font-size: .95rem; }
.q { font-weight: 600; color: var(--muted); }
.de { font-weight: 600; }
.big { font-size: 1.3rem; }
.huge { font-size: 1.75rem; margin: .2em 0; }
.pre { white-space: pre-line; }
.pl { color: var(--muted); }
.ex { font-style: italic; margin-top: .8em; }
.opts { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.opts.two { flex-direction: row; }
.opts.two .opt { flex: 1; }
.opt {
  min-height: 52px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px;
  background: var(--card); text-align: left; cursor: pointer; font-size: 1.05rem;
}
.row-wrap .opt { flex: 1 1 28%; text-align: center; }
.opt.small { font-size: 1rem; min-height: 50px; }
.opt.dunno { border-style: dashed; color: var(--muted); text-align: center; }
.opt.sel { border-color: var(--green); background: var(--green-soft); }
.opt.right, .slot.right { border-color: var(--green); background: var(--green-soft); }
.opt.wrong, .slot.wrong { border-color: var(--red); background: var(--red-soft); }
.opt:disabled { cursor: default; }
.slot { display: inline-block; min-width: 3.5em; padding: 0 6px; border-bottom: 3px solid var(--amber); text-align: center; border-radius: 6px; }
.pairs { display: flex; gap: 10px; margin-top: 12px; }
.pairs .col { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.pairs .opt.right { opacity: .55; }
.built {
  min-height: 64px; padding: 8px; border: 2px dashed var(--line); border-radius: 14px;
  display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; margin-top: 10px;
}
.built.right { border-color: var(--green); border-style: solid; }
.built.wrong { border-color: var(--red); border-style: solid; }
.pool { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.tok {
  min-height: 48px; padding: 8px 14px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--card); cursor: pointer; font-size: 1.05rem; font-weight: 600;
}
.tok:disabled { opacity: .3; }
.tok.in { border-color: var(--green); }
.inp {
  width: 100%; min-height: 52px; margin-top: 12px; padding: 10px 14px; font-size: 1.15rem;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text);
}
.inp:focus { outline: none; border-color: var(--green); }
.heard { color: var(--muted); }
.listen .link { display: block; }

/* informacja zwrotna */
.fb { display: none; }
.fb.show {
  display: block; margin-top: 16px; padding: 14px 16px; border-radius: 16px;
  animation: slide .25s ease;
}
.fb.good { background: var(--green-soft); }
.fb.bad { background: var(--red-soft); }
.fb-msg { font-weight: 700; margin-top: 0; }
.fb-sol { font-weight: 600; }
.fb-note { color: var(--muted); }

/* historia i scenka */
.scene-img { width: 100%; max-height: 180px; object-fit: contain; border-radius: 14px; }
.chat { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.bub { max-width: 88%; padding: 10px 12px; border-radius: 16px; box-shadow: var(--shadow); }
.bub.them { background: var(--card); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.bub.me { background: var(--green-soft); align-self: flex-end; border-bottom-right-radius: 4px; }
.bub p { margin: .2em 0; }
.bub .de { font-size: 1.12rem; }
.who { font-size: .82rem; color: var(--muted); font-weight: 600; }
.bub-act { display: flex; gap: 8px; margin-top: 6px; }
.narr { font-style: italic; color: var(--muted); text-align: center; margin: 4px 10px; }
.tip { color: var(--amber); font-weight: 600; font-style: normal; }
.reg { font-size: .92rem; color: var(--muted); }
.tag {
  display: inline-block; background: var(--amber-soft); color: var(--amber); font-weight: 700;
  border-radius: 6px; padding: 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em;
}
.goal { background: var(--blue-soft); border-radius: 14px; padding: 10px 14px; }
.summary { background: var(--green-soft); border-radius: 14px; padding: 10px 14px; }

/* objaśnienia */
.tbl { width: 100%; border-collapse: collapse; margin: 10px 0; background: var(--card); border-radius: 12px; overflow: hidden; }
.tbl td, .tbl th { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
.tbl th { font-size: .85rem; color: var(--muted); }
.tbl tr[onclick], .tbl tbody tr { cursor: pointer; }
.abc { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0; }
.letter {
  min-height: 56px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
}
.letter b { font-size: 1.2rem; }
.letter small { color: var(--muted); font-size: .8rem; }

/* fiszki */
.flash {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px;
  text-align: center; box-shadow: var(--shadow); margin-top: 8px;
}
.count { color: var(--muted); font-size: .9rem; margin: 0; }

/* wynik */
.result { text-align: center; padding-top: 24px; position: relative; }
.rosette {
  width: 92px; height: 92px; margin: 0 auto 8px; border-radius: 50%;
  background: repeating-conic-gradient(var(--green) 0 15deg, #3f8a66 15deg 30deg);
  display: grid; place-items: center; position: relative;
}
.rosette span { width: 52px; height: 52px; border-radius: 50%; background: var(--amber); border: 4px solid #fff; }
.rosette::before, .rosette::after {
  content: ""; position: absolute; top: 74px; width: 22px; height: 46px; background: var(--green); z-index: -1;
}
.rosette::before { left: 24px; transform: rotate(14deg); }
.rosette::after { right: 24px; transform: rotate(-14deg); }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.2s ease-in forwards; }

/* reakcje */
.bounce { animation: bounce .4s ease; }
.shake { animation: shake .4s ease; }
.pop { animation: pop .3s ease; }
.sway { animation: sway 5s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes pop { 0% { transform: scale(.92); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sway { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-3deg); } }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .8; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
