/* Layout: одна колонка до 880px; сверху — бренд и три раздела, ниже — рабочая область. Красный — польский акцент, остальное нейтрально. */
:root {
  --bg: #F2F3F6;
  --surface: #FFFFFF;
  --ink: #161A23;
  --muted: #5B6271;
  --line: #E0E3EA;
  --accent: #C8102E;
  --accent-ink: #FFFFFF;
  --accent-soft: #FBE8EB;
  --ok: #17804F;
  --ok-soft: #E2F3EA;
  --bad: #B93A0B;
  --bad-soft: #FCEBE2;
  --font-display: "Unbounded", "Segoe UI", system-ui, sans-serif;
  --font-body: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1117; --surface: #181B23; --ink: #ECEEF3; --muted: #9AA1AF; --line: #2A2F3A;
    --accent: #FF4762; --accent-ink: #12060A; --accent-soft: #3A1720;
    --ok: #3BCB85; --ok-soft: #14301F; --bad: #FF8B5C; --bad-soft: #3A2014;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1117; --surface: #181B23; --ink: #ECEEF3; --muted: #9AA1AF; --line: #2A2F3A;
  --accent: #FF4762; --accent-ink: #12060A; --accent-soft: #3A1720;
  --ok: #3BCB85; --ok-soft: #14301F; --bad: #FF8B5C; --bad-soft: #3A2014;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px 64px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 880px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand b { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand b i { font-style: normal; color: var(--accent); }
.brand span { font-size: 12px; color: var(--muted); }
.nav { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 6px 12px; border-radius: 999px; display: inline-flex; gap: 6px; align-items: center; }
.nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.badge { background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 6px; line-height: 18px; min-width: 18px; text-align: center; }
.sync { font-size: 12px; color: var(--muted); width: 100%; text-align: right; margin-top: -4px; }

h1, h2, h3 { text-wrap: balance; margin: 0; }
.display { font-family: var(--font-display); letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 28px 0 10px; }

.btn { border: 1px solid var(--line); background: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: .45; cursor: default; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: inline-grid; place-items: center; flex: none; }
.icon-btn svg { width: 18px; height: 18px; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.now { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip.has { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* now card */
.now { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin-top: 20px; }
.now .num { font-family: var(--font-display); font-size: 64px; line-height: .9; color: var(--accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.now .num small { display: block; font-size: 12px; font-family: var(--font-body); color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin-top: 6px; }
.now h2 { font-size: 22px; }
.meter { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter.ok > i { background: var(--ok); }

.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.stage-tile { padding: 14px 16px; }
.stage-tile .lvl { font-family: var(--font-display); font-size: 20px; font-weight: 700; }

.weeks { display: grid; gap: 6px; }
.week-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.week-row:hover { border-color: var(--muted); }
.week-row .wn { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--muted); font-variant-numeric: tabular-nums; }
.week-row.is-done .wn { color: var(--ok); }
.week-row.is-now { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.week-row.is-now .wn { color: var(--accent); }
.week-row .wt { font-weight: 600; line-height: 1.3; }
.week-row .ws { font-size: 13px; color: var(--muted); }
.week-row.is-review { background: transparent; border-style: dashed; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.chips .chip { flex: none; }

/* week view */
.crumbs { margin: 18px 0 6px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.crumbs a { text-decoration: none; font-weight: 600; font-size: 14px; }
.wk-head h1 { font-size: 28px; line-height: 1.15; margin: 4px 0 10px; }
.kicker { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .05em; text-transform: uppercase; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 22px 0 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.sessions { display: grid; gap: 8px; }
.session { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; text-align: left; width: 100%; }
.session .box { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; margin-top: 1px; }
.session.on .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.session.on b { text-decoration: line-through; text-decoration-color: var(--muted); }
.session b { display: block; }
.session span { color: var(--muted); font-size: 14px; }
.note { background: var(--accent-soft); color: var(--ink); border-radius: 12px; padding: 12px 16px; font-size: 15px; }

.gram { line-height: 1.6; }
.gram h3 { font-size: 17px; margin: 18px 0 6px; }
.gram h3:first-child { margin-top: 0; }
.gram p { margin: 6px 0; max-width: 68ch; }
.gram ul { margin: 6px 0; padding-left: 20px; }
.gram .tbl { overflow-x: auto; margin: 8px 0; }
.gram table { border-collapse: collapse; font-size: 15px; min-width: 280px; }
.gram th, .gram td { border-bottom: 1px solid var(--line); padding: 6px 14px 6px 0; text-align: left; vertical-align: top; }
.gram th { color: var(--muted); font-weight: 600; font-size: 13px; }
.pl { font-weight: 600; }
.gram .pl { color: var(--accent); }
.eg { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; margin: 8px 0; }
.eg div { font-weight: 600; }
.eg span { color: var(--muted); font-size: 14px; }

.vocab { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.vw { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 8px 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.vw .pl { display: block; line-height: 1.3; }
.vw .ru { font-size: 14px; color: var(--muted); line-height: 1.3; }
.vw .lvl { width: 6px; height: 28px; border-radius: 3px; background: var(--line); }

/* trainer + exercises */
.stage { min-height: 300px; display: grid; gap: 16px; align-content: start; }
.progress-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.progress-dots i { width: 10px; height: 10px; border-radius: 3px; background: var(--line); }
.progress-dots i.ok { background: var(--ok); }
.progress-dots i.bad { background: var(--bad); }
.progress-dots i.cur { background: var(--ink); }
.flash { min-height: 190px; display: grid; place-items: center; text-align: center; padding: 28px 20px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); width: 100%; }
.flash .front { font-size: 30px; font-weight: 700; line-height: 1.2; }
.flash .back { font-size: 20px; color: var(--muted); margin-top: 10px; }
.flash .hint { font-size: 13px; color: var(--muted); margin-top: 14px; }
.q { font-size: 20px; font-weight: 600; line-height: 1.35; }
.q-help { font-size: 14px; color: var(--muted); }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; cursor: pointer; font-size: 17px; }
.opt:hover:not([disabled]) { border-color: var(--muted); }
.opt.ok { background: var(--ok-soft); border-color: var(--ok); }
.opt.bad { background: var(--bad-soft); border-color: var(--bad); }
.opt[disabled] { cursor: default; }
.answer-in { width: 100%; font: inherit; font-size: 20px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.answer-in:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.kbd { display: flex; gap: 4px; flex-wrap: wrap; }
.kbd button { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 17px; font-weight: 600; }
.feedback { border-radius: 12px; padding: 12px 16px; font-size: 15px; }
.feedback.ok { background: var(--ok-soft); }
.feedback.bad { background: var(--bad-soft); }
.feedback b { display: block; margin-bottom: 2px; }
.words { display: flex; gap: 6px; flex-wrap: wrap; min-height: 46px; padding: 6px; border-radius: 12px; }
.words.target { border: 1px dashed var(--line); background: var(--surface); }
.word { padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 17px; font-weight: 600; }
.word.used { visibility: hidden; }
.result { text-align: center; padding: 28px 20px; }
.result .big { font-family: var(--font-display); font-size: 52px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { padding: 16px; }
.tile .v { font-family: var(--font-display); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile .l { font-size: 13px; color: var(--muted); margin-top: 4px; }
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; max-width: 280px; }
.heat i { aspect-ratio: 1; border-radius: 4px; background: var(--line); }
.heat i.on { background: var(--ok); }
.heat i.today { outline: 2px solid var(--ink); outline-offset: -2px; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.toggle button { border: 0; background: var(--surface); padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); }
.toggle button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.confirm { border: 1px solid var(--bad); }

@media (max-width: 640px) {
  .stages { grid-template-columns: 1fr; }
  .now { grid-template-columns: 1fr; gap: 8px; }
  .now .num { font-size: 48px; }
  .week-row { grid-template-columns: 34px 1fr; }
  .week-row .chips { grid-column: 2; justify-content: flex-start; }
  .wk-head h1 { font-size: 23px; }
  .flash .front { font-size: 26px; }
  .nav a { padding: 6px 10px; }
  .tabs button { padding: 10px 10px; font-size: 15px; }
}
@media (prefers-reduced-motion: no-preference) {
  .opt, .btn, .word, .session { transition: border-color .15s, background-color .15s; }
  .meter > i { transition: width .4s; }
}

/* site additions */
.login { max-width: 400px; margin: 10vh auto 0; display: grid; gap: 14px; }
.login h1 { font-size: 26px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: var(--muted); }
.field input { font: inherit; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.field input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; }
.okmsg { color: var(--ok); font-size: 14px; }
.user-chip { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.user-chip b { color: var(--ink); font-weight: 600; }
.pic { width: 30px; height: 30px; flex: none; }
.vw.has-pic { grid-template-columns: 30px 1fr auto; padding-left: 10px; }
.flash .pic-big { width: 84px; height: 84px; display: block; margin: 0 auto 14px; }
.tbl-wrap { overflow-x: auto; }
.students { width: 100%; border-collapse: collapse; font-size: 15px; }
.students th, .students td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.students th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.students td.num { font-variant-numeric: tabular-nums; }
.students .who b { display: block; }
.students .who span { color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 10px; align-items: end; }
.footer { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.footer a { color: var(--muted); }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--bg); display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; }
.students td:last-child { white-space: normal; min-width: 180px; }
.students .btn.small { padding: 6px 10px; font-size: 14px; }
@media (max-width: 640px) {
  .user-chip b { display: none; }
  .top-in { gap: 8px; }
  .brand span { display: none; }
}
