/* ==========================================================================
   English for Travel – style
   Mobile-first, jasny/ciemny motyw, bez zewnętrznych zależności.
   ========================================================================== */

:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ef;
  --text: #1c2622;
  --muted: #5d6b65;
  --border: #dde3df;
  --primary: #0f766e;
  --primary-600: #0d655e;
  --primary-soft: #d5f0ec;
  --accent: #f59e0b;
  --accent-soft: #fdf0d5;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --bad: #c2410c;
  --bad-soft: #ffedd5;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 4px 16px rgba(16, 24, 20, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --nav-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b100e;
  --surface: #141c19;
  --surface-2: #1b2622;
  --text: #e7eeeb;
  --muted: #9aaba4;
  --border: #283530;
  --primary: #2dd4bf;
  --primary-600: #5eead4;
  --primary-soft: #113430;
  --accent: #fbbf24;
  --accent-soft: #352a10;
  --ok: #4ade80;
  --ok-soft: #102c1b;
  --bad: #fb923c;
  --bad-soft: #341f12;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 4px 16px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 1rem; }
kbd {
  font: 600 .75rem/1 var(--font);
  padding: .15rem .35rem;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
}

.skip-link { position: absolute; left: -999px; top: 0; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 99; background: var(--surface); padding: .5rem 1rem; }

/* ---------- Pasek górny i nawigacja ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--text); }
.brand-logo { font-size: 1.4rem; }
.brand-name { font-size: 1.05rem; letter-spacing: -.01em; }
.brand-name b { color: var(--primary); }
.topbar-stats { margin-left: auto; display: flex; gap: .4rem; }
.pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .6rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-weight: 600; font-size: .875rem; white-space: nowrap;
}

.mainnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.mainnav a {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600;
}
.mainnav a span:first-child { font-size: 1.25rem; }
.mainnav a.active { color: var(--primary); }
.mainnav a.active::before {
  content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--primary);
}
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #1c1300; font: 700 .7rem/18px var(--font); font-style: normal;
}

@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .mainnav {
    position: sticky; top: 57px; bottom: auto; height: auto; padding: 0 1rem;
    justify-content: center; gap: .25rem; border-top: 0; border-bottom: 1px solid var(--border);
    background: var(--bg);
  }
  .mainnav a { flex: 0 0 auto; flex-direction: row; gap: .4rem; padding: .65rem .9rem; font-size: .9rem; }
  .mainnav a span:first-child { font-size: 1rem; }
  .mainnav a.active::before { top: auto; bottom: 0; left: .6rem; right: .6rem; border-radius: 3px 3px 0 0; }
  .badge { position: static; }
}

main { max-width: 860px; margin: 0 auto; padding: 1rem; outline: none; }

/* ---------- Karty i przyciski ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.card-title { display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .6rem 1.1rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 650; text-decoration: none; cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #04201c; }
.btn.primary:hover:not([disabled]) { background: var(--primary-600); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1c1300; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.big { min-height: 52px; font-size: 1.05rem; padding: .75rem 1.4rem; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 1.05rem; text-decoration: none; color: var(--text);
}
.icon-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.icon-btn.sm { width: 32px; height: 32px; font-size: .9rem; }
.icon-btn.on { background: var(--accent-soft); border-color: var(--accent); }

.page-head { display: flex; align-items: center; gap: .75rem; margin: .25rem 0 1rem; }
.page-head h1 { margin: 0; font-size: 1.35rem; }
.page-head .sub { color: var(--muted); font-size: .9rem; }

/* ---------- Strona główna ---------- */
.hero {
  display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center;
  background: linear-gradient(135deg, var(--primary) 0%, #115e59 100%);
  color: #fff; border: 0;
}
:root[data-theme="dark"] .hero { background: linear-gradient(135deg, #11463f, #0c2c29); }
.hero h1 { font-size: 1.35rem; margin-bottom: .25rem; }
.hero p { margin: 0; opacity: .92; }
.ring { position: relative; width: 84px; height: 84px; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; line-height: 1.05; font-size: .95rem; }
.ring .ring-label small { display: block; font-weight: 600; font-size: .65rem; opacity: .85; }
.hero .row { margin-top: .6rem; }
.hero .pill { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.25); color: #fff; }

.continue {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  border: 2px solid var(--primary); background: var(--primary-soft);
}
.continue .big-icon { font-size: 2.2rem; }
.continue .txt { flex: 1; min-width: 180px; }
.continue .txt strong { display: block; font-size: 1.05rem; }

.section-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; margin: 1.5rem 0 .75rem; }
.section-title h2 { margin: 0; }

.units { display: grid; grid-template-columns: 1fr; gap: .75rem; }
@media (min-width: 560px) { .units { grid-template-columns: 1fr 1fr; } }
.unit-card {
  display: grid; grid-template-columns: auto 1fr; gap: .25rem .9rem; align-items: center;
  padding: .9rem 1rem; border-radius: var(--radius); text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .12s ease, border-color .12s ease;
}
.unit-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.unit-card .u-icon {
  grid-row: span 3; width: 54px; height: 54px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.7rem; background: var(--surface-2);
}
.unit-card .u-num { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.unit-card .u-title { font-weight: 750; line-height: 1.2; }
.unit-card .u-title span { display: block; font-weight: 500; font-size: .875rem; color: var(--muted); }
.unit-card.done .u-icon { background: var(--ok-soft); }
.unit-card.current { border: 2px solid var(--primary); }
.unit-card.locked { opacity: .55; cursor: not-allowed; }
.unit-card.locked:hover { transform: none; border-color: var(--border); }
.dots { display: flex; gap: 4px; margin-top: .2rem; }
.dots i { width: 22px; height: 6px; border-radius: 3px; background: var(--border); }
.dots i.on { background: var(--primary); }

/* ---------- Lekcja: kroki ---------- */
.unit-hero { display: flex; gap: 1rem; align-items: center; }
.unit-hero .u-icon { font-size: 2.6rem; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.step a {
  display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.step a:hover { border-color: var(--primary); }
.step .s-icon { font-size: 1.5rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); }
.step .s-txt { flex: 1; }
.step .s-txt strong { display: block; }
.step .s-txt span { color: var(--muted); font-size: .875rem; }
.step .s-state { font-size: 1.2rem; }
.step.done .s-icon { background: var(--ok-soft); }
.step.next a { border: 2px solid var(--primary); }

/* ---------- Fiszki ---------- */
.flash-wrap { max-width: 520px; margin: 0 auto; }
.flashcard {
  position: relative; min-height: 300px; padding: 1.5rem; border-radius: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  text-align: center; cursor: pointer; user-select: none;
}
.flashcard .fc-en { font-size: 2.1rem; font-weight: 800; letter-spacing: -.01em; }
.flashcard .fc-pl { font-size: 1.3rem; color: var(--primary); font-weight: 700; }
.flashcard .fc-ex { color: var(--muted); }
.flashcard .fc-ex b { color: var(--text); font-weight: 600; }
.flashcard .fc-hint { color: var(--muted); font-size: .875rem; }
.flashcard .fc-back { display: none; flex-direction: column; align-items: center; gap: .5rem; }
.flashcard.flipped .fc-back { display: flex; animation: pop .2s ease; }
.flashcard.flipped .fc-hint { display: none; }
.flash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }

/* ---------- Listy zwrotów ---------- */
.list { display: grid; gap: .5rem; }
.phrase {
  display: flex; align-items: center; gap: .75rem; padding: .75rem .9rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
}
.phrase .p-txt { flex: 1; min-width: 0; }
.phrase .p-en { font-weight: 650; }
.phrase .p-pl { color: var(--muted); font-size: .925rem; }
.phrase .p-meta { font-size: .75rem; color: var(--muted); }
.self-test .phrase .p-pl { filter: blur(6px); cursor: pointer; transition: filter .2s; }
.self-test .phrase .p-pl.revealed { filter: none; }
.phrase.playing { border-color: var(--primary); background: var(--primary-soft); }

/* ---------- Gramatyka ---------- */
.explain p { margin-bottom: .8rem; }
.explain strong { color: var(--primary); }
.quiz-item { padding: .9rem 0; border-top: 1px dashed var(--border); }
.quiz-item .q { font-size: 1.1rem; font-weight: 650; margin-bottom: .5rem; }
.quiz-item .q .gap { display: inline-block; min-width: 3.5em; border-bottom: 2px solid var(--primary); text-align: center; color: var(--primary); }
.quiz-item .hint { font-size: .85rem; color: var(--muted); margin-top: .35rem; }

/* ---------- Sesja ćwiczeń ---------- */
.session { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; min-height: calc(100vh - 190px); }
.session-top { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.progress { flex: 1; height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .35s ease; }
.session-count { font-size: .85rem; font-weight: 700; color: var(--muted); min-width: 3.5em; text-align: right; }
.ex { flex: 1; }
.ex-prompt { font-size: .95rem; font-weight: 700; color: var(--muted); margin-bottom: .6rem; text-transform: uppercase; letter-spacing: .04em; }
.ex-question { display: flex; align-items: center; gap: .75rem; font-size: 1.6rem; font-weight: 750; margin-bottom: 1.25rem; line-height: 1.25; }
.ex-question.pl { color: var(--text); }
.ex-question .gap { color: var(--primary); }
.ex-hint { font-size: .9rem; color: var(--muted); margin: -.75rem 0 1rem; }
.listen-big { display: flex; gap: 1rem; justify-content: center; margin: .5rem 0 1.5rem; }
.listen-big .icon-btn { width: 84px; height: 84px; font-size: 2rem; border-width: 2px; border-color: var(--primary); }
.listen-big .icon-btn.sm { width: 56px; height: 56px; font-size: 1.3rem; align-self: center; }

.options { display: grid; gap: .6rem; }
@media (min-width: 560px) { .options.two { grid-template-columns: 1fr 1fr; } }
.option {
  display: flex; align-items: center; gap: .75rem; width: 100%; text-align: left;
  min-height: 54px; padding: .7rem .9rem; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 2px solid var(--border); border-bottom-width: 4px;
  font-size: 1.05rem; font-weight: 600;
}
.option:hover:not([disabled]) { border-color: var(--primary); }
.option .key { flex: none; }
.option.selected { border-color: var(--primary); background: var(--primary-soft); }
.option.right { border-color: var(--ok); background: var(--ok-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option[disabled] { cursor: default; }

.type-input {
  width: 100%; min-height: 110px; padding: .9rem 1rem; border-radius: 14px; resize: vertical;
  border: 2px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 1.15rem/1.4 var(--font);
}
.type-input:focus { border-color: var(--primary); outline: none; }

.answer-line {
  min-height: 64px; display: flex; flex-wrap: wrap; gap: .45rem; align-content: flex-start;
  padding: .6rem 0 .8rem; border-bottom: 2px solid var(--border); margin-bottom: 1rem;
}
.tiles { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; }
.tile {
  padding: .5rem .8rem; border-radius: 10px; cursor: pointer; font-weight: 650; font-size: 1.05rem;
  background: var(--surface); border: 2px solid var(--border); border-bottom-width: 4px;
}
.tile:hover { border-color: var(--primary); }
.tile.used { visibility: hidden; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.match-col { display: grid; gap: .6rem; }
.match-btn {
  min-height: 52px; padding: .5rem .7rem; border-radius: 12px; cursor: pointer; font-weight: 600;
  background: var(--surface); border: 2px solid var(--border); border-bottom-width: 4px; text-align: center;
}
.match-btn:hover:not([disabled]) { border-color: var(--primary); }
.match-btn.sel { border-color: var(--primary); background: var(--primary-soft); }
.match-btn.done { opacity: .35; border-color: var(--ok); background: var(--ok-soft); cursor: default; }
.match-btn.bad { animation: shake .35s; border-color: var(--bad); }

.speak-box { text-align: center; }
.speak-btn {
  width: 96px; height: 96px; border-radius: 50%; font-size: 2.4rem; cursor: pointer;
  border: 3px solid var(--primary); background: var(--primary-soft); margin: .5rem auto 1rem; display: grid; place-items: center;
}
.speak-btn.listening { animation: pulse 1.1s infinite; background: var(--accent-soft); border-color: var(--accent); }
.heard { min-height: 1.5em; color: var(--muted); font-style: italic; }

.feedback {
  display: none; margin: 1rem -1rem 0; padding: 1rem; border-radius: var(--radius) var(--radius) 0 0;
}
.feedback.show { display: block; animation: slideup .2s ease; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.almost { background: var(--accent-soft); color: #8a5a00; }
:root[data-theme="dark"] .feedback.almost { color: var(--accent); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback .fb-title { font-weight: 800; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; }
.feedback .fb-body { color: var(--text); margin-top: .35rem; font-size: 1.05rem; }
.feedback .fb-body .icon-btn { vertical-align: middle; margin-left: .25rem; }
.session-foot { display: flex; gap: .75rem; padding: 1rem 0; position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--bg); }
@media (min-width: 760px) { .session-foot { bottom: 0; } }
.session-foot .btn.primary { flex: 1; }
.kbd-hint { font-size: .8rem; color: var(--muted); text-align: center; margin-top: .25rem; }
@media (hover: none) { .kbd-hint, .option .key { display: none; } }

/* ---------- Wyniki ---------- */
.result { text-align: center; }
.result .emoji { font-size: 3.5rem; }
.score-big { font-size: 3rem; font-weight: 850; color: var(--primary); line-height: 1; margin: .5rem 0; }
.result .row { justify-content: center; }
.mistakes { text-align: left; }

/* ---------- Dialog ---------- */
.scene { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: .6rem .9rem; margin-bottom: 1rem; }
.chat { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.bubble {
  max-width: 85%; padding: .65rem .9rem; border-radius: 18px; position: relative;
  box-shadow: var(--shadow); animation: pop .2s ease;
}
.bubble .b-en { font-weight: 600; display: flex; gap: .5rem; align-items: flex-start; }
.bubble .b-en span { flex: 1; }
.bubble .b-pl { font-size: .875rem; opacity: .8; margin-top: .2rem; }
.bubble.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.bubble.you { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
:root[data-theme="dark"] .bubble.you { color: #04201c; }
.bubble.you .icon-btn { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.35); color: inherit; }
.bubble.speaking { outline: 3px solid var(--accent); }
.bubble .who { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.choices { display: grid; gap: .5rem; }
.choices .option.shake { animation: shake .35s; }
.hide-pl .b-pl { display: none; }

/* ---------- Rozmówki ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.search {
  flex: 1; min-width: 200px; min-height: 44px; padding: .55rem .9rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: .5rem; scrollbar-width: thin; }
.chip {
  flex: none; padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: .875rem; font-weight: 600; white-space: nowrap;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
:root[data-theme="dark"] .chip.active { color: #04201c; }
.pb-group h3 { margin: 1.25rem 0 .5rem; }

/* ---------- Statystyki ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; text-align: center; }
.stat b { display: block; font-size: 1.7rem; color: var(--primary); line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.boxes { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; align-items: end; height: 150px; }
.boxes .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .25rem; }
.boxes .bar { width: 100%; max-width: 56px; border-radius: 8px 8px 0 0; background: var(--primary); min-height: 3px; }
.boxes .col:nth-child(1) .bar { background: #f97316; }
.boxes .col:nth-child(2) .bar { background: #f59e0b; }
.boxes .col:nth-child(3) .bar { background: #84cc16; }
.boxes .col:nth-child(4) .bar { background: #22c55e; }
.boxes .col:nth-child(5) .bar { background: var(--primary); }
.boxes .lbl { font-size: .75rem; color: var(--muted); text-align: center; }
.unit-table { width: 100%; border-collapse: collapse; font-size: .925rem; }
.unit-table td, .unit-table th { padding: .45rem .3rem; border-bottom: 1px solid var(--border); text-align: left; }
.unit-table td.num, .unit-table th.num { text-align: right; }
.week { display: flex; gap: .35rem; justify-content: space-between; }
.week .day { flex: 1; text-align: center; font-size: .75rem; color: var(--muted); }
.week .day i { display: block; height: 28px; border-radius: 8px; background: var(--surface-2); margin-bottom: .2rem; }
.week .day i.on { background: var(--accent); }
.week .day i.goal { background: #22c55e; }

/* ---------- Ustawienia ---------- */
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.form-row:last-child { border-bottom: 0; }
.form-row label, .form-row .lbl { font-weight: 600; }
.form-row .desc { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); }
.form-row select, .form-row input[type="number"] {
  min-height: 40px; padding: .4rem .6rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; max-width: 55%;
}
.form-row input[type="range"] { accent-color: var(--primary); }
.switch { position: relative; width: 50px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--border); transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.notice { padding: .75rem 1rem; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid var(--accent); font-size: .925rem; margin-bottom: 1rem; }

/* ---------- Certyfikat ---------- */
.cert {
  text-align: center; padding: 2.5rem 1.5rem; border: 6px double var(--primary); border-radius: 12px;
  background: var(--surface);
}
.cert .c-title { font-size: 2rem; font-weight: 850; color: var(--primary); letter-spacing: .02em; }
.cert .c-name { font-size: 1.6rem; font-weight: 700; border-bottom: 1px solid var(--border); display: inline-block; min-width: 60%; padding: .5rem 0; margin: 1rem 0; }
.cert input.c-name { background: transparent; border: 0; border-bottom: 1px solid var(--border); text-align: center; color: var(--text); font: 700 1.6rem var(--font); }

/* ---------- Toast i konfetti ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: .65rem 1.1rem; border-radius: 12px; font-weight: 600;
  transition: .25s ease; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 760px) { .toast { bottom: 1.5rem; } }
.confetti-piece { position: fixed; top: -12px; z-index: 60; width: 9px; height: 14px; border-radius: 2px; pointer-events: none; animation: fall linear forwards; }

@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideup { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.5); } 50% { box-shadow: 0 0 0 16px rgba(245,158,11,0); } }

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

/* ---------- Wydruk (ściąga z rozmówkami, certyfikat) ---------- */
@media print {
  .topbar, .mainnav, .toolbar, .chips, .no-print, .icon-btn, .toast { display: none !important; }
  body { background: #fff; color: #000; padding: 0; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .card, .phrase { box-shadow: none; border-color: #bbb; }
  .phrase { padding: .25rem .5rem; break-inside: avoid; }
  .self-test .phrase .p-pl { filter: none; }
  .pb-group { break-inside: avoid-page; }
  .cert { border-color: #0f766e; }
}
