/* Free public lessons (/learn/, /learn/<slug>) - see src/worker.js "Free public lessons". */
.ls-wrap { max-width: 760px; margin: 0 auto; padding: clamp(1.25rem, 4vw, 2.5rem) clamp(1rem, 4vw, 2rem) 4rem; }
.ls-crumb { margin: 0 0 0.9rem; font-size: 0.9rem; }
.ls-crumb a { color: var(--muted); }
.ls-head h1 { font-size: clamp(1.6rem, 6vw + 0.2rem, 2.6rem); margin: 0 0 0.5rem; overflow-wrap: break-word; }
.ls-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin: 0 0 0.6rem; color: var(--muted); font-size: 0.95rem; }
.ls-lv { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; border: 2px solid var(--ink); background: var(--accent-2); color: #171233; font-weight: 800; font-size: 0.8rem; }
.ls-lede { margin: 0 0 1.6rem; line-height: 1.55; }

/* the three languages of a server-written phrase: CSS shows the one matching <html lang> */
.t-uk, .t-ru, .t-en { display: none; }
html[lang="uk"] .t-uk, html[lang="ru"] .t-ru, html[lang="en"] .t-en { display: inline; }

.ls-sec { margin: 0 0 2.2rem; }
.ls-sec > h2 { font-size: clamp(1.15rem, 3.5vw + 0.3rem, 1.5rem); margin: 0 0 0.9rem; }
.ls-note { margin: -0.4rem 0 0.9rem; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

.ls-rule { list-style: none; margin: 0; padding: 1rem 1.1rem; display: grid; gap: 0.75rem; background: var(--surface); border: 2px solid var(--ink); border-radius: 16px; line-height: 1.6; }
.ls-rule li { overflow-wrap: break-word; }
.ls-rule em { color: var(--accent-3); font-style: normal; font-weight: 600; }
.ls-rule code { font: inherit; font-weight: 600; }

.ls-qs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; counter-reset: q; }
.ls-q { counter-increment: q; background: var(--surface); border: 2px solid var(--border); border-radius: 14px; padding: 0.85rem 0.95rem; }
.ls-q p { margin: 0 0 0.65rem; font-weight: 600; line-height: 1.5; overflow-wrap: break-word; }
.ls-q p::before { content: counter(q) ". "; color: var(--muted); font-weight: 700; }
.ls-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.ls-opt { font: inherit; font-size: 0.97rem; text-align: left; min-width: 0; overflow-wrap: anywhere; padding: 0.65rem 0.8rem; border-radius: 11px; border: 1px solid var(--border); background: var(--paper); color: var(--ink); cursor: pointer; }
.ls-opt:hover:not(:disabled) { border-color: var(--accent); }
.ls-opt:disabled { cursor: default; }
.ls-opt.right { border-color: #2e7d32; background: color-mix(in srgb, #2e7d32 16%, var(--surface)); font-weight: 700; }
.ls-opt.wrong { border-color: #c0392b; background: color-mix(in srgb, #c0392b 13%, var(--surface)); }
.ls-q.is-right { border-color: #2e7d32; }
.ls-q.is-wrong { border-color: #c0392b; }

.ls-score { margin: 1rem 0 0; padding: 1rem 1.1rem; border: 2px solid var(--ink); border-radius: 16px; background: var(--surface); }
.ls-score b.n { display: block; font-family: "Unbounded", sans-serif; font-weight: 800; font-size: 1.9rem; line-height: 1.1; color: var(--accent); margin: 0 0 0.3rem; }
.ls-score p { margin: 0 0 0.8rem; line-height: 1.5; }
.ls-progress { margin: 0.9rem 0 0; color: var(--muted); font-size: 0.9rem; }

.ls-words { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
@media (max-width: 620px) { .ls-words { grid-template-columns: minmax(0, 1fr); } }
.ls-word { background: var(--surface); border: 2px solid var(--border); border-radius: 14px; padding: 0.75rem 0.9rem; min-width: 0; }
.ls-w-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ls-w-top b { font-size: 1.08rem; overflow-wrap: anywhere; }
.ls-say { flex: none; font: inherit; font-size: 1rem; line-height: 1; width: 2.3rem; height: 2.3rem; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); cursor: pointer; }
.ls-pos { color: var(--muted); font-size: 0.78rem; }
.ls-word p { margin: 0.3rem 0 0; line-height: 1.45; overflow-wrap: break-word; }
.ls-tr { font-weight: 600; color: var(--accent); }
html[lang="en"] .ls-tr { display: none; }
.ls-mean { font-size: 0.92rem; }
.ls-ex { font-size: 0.92rem; color: var(--muted); font-style: italic; }

.ls-cta { background: var(--surface); border: 2px solid var(--ink); border-radius: 18px; padding: clamp(1rem, 4vw, 1.5rem); box-shadow: 6px 6px 0 0 color-mix(in srgb, var(--ink) 45%, transparent); }
.ls-cta h2 { font-size: clamp(1.15rem, 3.5vw + 0.3rem, 1.5rem); margin: 0 0 0.6rem; }
.ls-cta p { margin: 0 0 1rem; line-height: 1.55; }
.ls-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
@media (max-width: 520px) { .ls-btns { grid-template-columns: minmax(0, 1fr); } }
.ls-btns .btn { text-align: center; justify-content: center; min-width: 0; white-space: normal; }

/* the list page */
.ls-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.ls-card { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0.15rem 0.75rem; text-decoration: none; padding: 0.9rem 1rem; border-radius: 16px; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); box-shadow: 4px 4px 0 0 var(--ink); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.ls-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 0 var(--ink); }
.ls-card .ls-lv { grid-row: 1 / span 2; }
.ls-card b { font-size: 1.08rem; overflow-wrap: anywhere; }
.ls-card .d { grid-column: 2; color: var(--muted); font-size: 0.9rem; }

/* jump links under the heading: one even row */
.ls-jump { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; margin: 0 0 1.8rem; }
.ls-jump a { text-align: center; text-decoration: none; font-weight: 700; font-size: 0.86rem; padding: 0.55rem 0.2rem; border-radius: 12px; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); overflow-wrap: anywhere; }
.ls-jump a:hover { background: var(--accent); color: var(--accent-ink); }
.ls-sec { scroll-margin-top: 5.5rem; }
@media (max-width: 400px) { .ls-jump { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* the story */
.ls-story { background: var(--surface); border: 2px solid var(--ink); border-radius: 16px; padding: 1rem 1.1rem; }
.ls-story h3 { font-size: 1.1rem; margin: 0 0 0.7rem; }
.ls-story p { margin: 0 0 0.9rem; line-height: 1.75; font-size: 1.03rem; overflow-wrap: break-word; }
.ls-story p:last-child { margin-bottom: 0; }
.ls-say-sm { width: 1.9rem; height: 1.9rem; font-size: 0.8rem; vertical-align: middle; }
.sw { cursor: pointer; border-bottom: 1px dotted color-mix(in srgb, var(--ink) 45%, transparent); }
.sw:hover, .sw.is-on { background: color-mix(in srgb, var(--accent-2) 55%, transparent); border-bottom-color: transparent; border-radius: 4px; }
.ls-h3 { font-size: 1.05rem; margin: 1.3rem 0 0.8rem; }
.ls-pop { position: fixed; left: 50%; bottom: 0.9rem; transform: translateX(-50%); z-index: 30; width: min(26rem, calc(100vw - 1.5rem)); display: grid; gap: 0.15rem; padding: 0.75rem 1rem; border-radius: 14px; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); box-shadow: 5px 5px 0 0 var(--accent-2); }
.ls-pop[hidden] { display: none; }
.ls-pop b { font-size: 1.1rem; overflow-wrap: anywhere; }
.ls-pop .tr { font-weight: 700; color: var(--accent); overflow-wrap: anywhere; }
.ls-pop .en { font-size: 0.88rem; color: var(--muted); line-height: 1.4; }

/* Header of the lesson pages: the homepage's two rows (brand, language, dark mode, log in /
   four links). assets/style.css lays the shared .topbar out differently, hence the .tb overrides. */
.topbar.tb .wrap { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: none; justify-content: stretch; gap: 0.5rem; padding-block: 0.7rem 0.55rem; }
.tb .tb-row1 { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; min-width: 0; }
.tb .tb-tools { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.tb .brand, .tb .theme-toggle, .tb .lang-switch { grid-area: auto; justify-self: auto; }
.tb .tb-login { font-weight: 700; font-size: 0.85rem; text-decoration: none; white-space: nowrap; padding: 0.4rem 0.95rem; border-radius: 999px; border: 2px solid var(--ink); background: var(--surface); color: var(--ink); max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.tb .tb-login:hover { background: var(--accent); color: var(--accent-ink); }
.tb .tb-links { display: flex; gap: clamp(1.1rem, 3vw, 2.2rem); font-size: 0.92rem; font-weight: 600; min-width: 0; }
.tb .tb-links a { text-decoration: none; color: var(--muted); white-space: nowrap; padding: 0.15rem 0; border-bottom: 2px solid transparent; transition: color 0.15s ease, border-color 0.15s ease; }
.tb .tb-links a:hover, .tb .tb-links a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.tb .tb-links .s { display: none; }
.ls-sec { scroll-margin-top: 7rem; }
@media (max-width: 640px) {
  .tb .brand { font-size: 0.85rem; text-align: left; }
  .tb .tb-tools { gap: 0.25rem; }
  .tb .tb-row1 { gap: 0.5rem; }
  .tb .lang-switch { padding: 0.15rem; gap: 0.1rem; border: 1px solid var(--border); background: var(--surface); }
  .tb .lang-switch button { padding: 0.25rem 0.3rem; font-size: 0.72rem; }
  .tb .theme-toggle { width: 1.9rem; height: 1.9rem; font-size: 0.9rem; }
  .tb .tb-login { flex: 0 1 auto; min-width: 4.1rem; padding: 0.35rem 0.5rem; font-size: 0.8rem; max-width: 7.5rem; text-align: center; }
  .tb .tb-links { justify-content: space-between; gap: 0.5rem; font-size: 0.84rem; }
  .tb .tb-links .f { display: none; }
  .tb .tb-links .s { display: inline; }
}
@media (max-width: 400px) { .tb .brand-rest { display: none; } }

/* the list page: one group per level */
.ls-lvh { font-size: 1.05rem; margin: 1.6rem 0 0.7rem; color: var(--muted); }
.ls-lvh:first-child { margin-top: 0; }

/* The rule in the reader's language. Each line carries the English original (.r-en) and, when the
   topic has them, Ukrainian (.r-uk) and Russian (.r-ru). A Ukrainian / Russian page shows the
   English line with the translation under it; English examples stay English in all three. */
.ls-rule .r-uk, .ls-rule .r-ru { display: none; }
html[lang="uk"] .ls-rule[data-tr~="uk"] .r-en, html[lang="ru"] .ls-rule[data-tr~="ru"] .r-en { display: block; }
html[lang="uk"] .ls-rule[data-tr~="uk"] .r-uk, html[lang="ru"] .ls-rule[data-tr~="ru"] .r-ru { display: block; margin-top: 0.3rem; padding-left: 0.8rem; border-left: 3px solid var(--accent-2); color: var(--muted); font-size: 0.95em; }
html[lang="uk"] .ls-rule[data-tr~="uk"], html[lang="ru"] .ls-rule[data-tr~="ru"] { gap: 1.1rem; }

/* ---------- kids lesson ---------- */
.kd-emoji { font-size: 0.9em; }
.kd-jump { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 400px) { .kd-jump { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kd-words { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
@media (max-width: 620px) { .kd-words { grid-template-columns: minmax(0, 1fr); } }
.kd-word { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.8rem; align-items: center; background: var(--surface); border: 2px solid var(--border); border-radius: 16px; padding: 0.75rem 0.9rem; min-width: 0; }
.kd-pic { font-size: 2.4rem; line-height: 1.1; min-width: 3.4rem; text-align: center; white-space: nowrap; }
.kd-w { min-width: 0; }
.kd-w p { margin: 0.25rem 0 0; line-height: 1.45; overflow-wrap: break-word; }
html[lang="en"] .ls-tr.kd-tr { display: block; color: var(--muted); font-weight: 500; }
.kd-pattern { background: var(--surface); border: 2px solid var(--ink); border-radius: 16px; padding: 1rem 1.1rem; }
.kd-frame { margin: 0 0 0.7rem; font-family: "Unbounded", sans-serif; font-weight: 800; font-size: clamp(1.2rem, 5vw, 1.6rem); color: var(--accent); overflow-wrap: break-word; }
.kd-ex { list-style: none; margin: 0 0 0.7rem; padding: 0; display: grid; gap: 0.45rem; font-size: 1.05rem; }
.kd-hint { margin: 0; color: var(--muted); line-height: 1.5; }
html[lang="en"] .kd-hint { display: none; }
.kd-page { padding: 0.9rem 0; border-top: 1px dashed var(--border); }
.kd-page:first-child { border-top: 0; padding-top: 0; }
.kd-page:last-child { padding-bottom: 0; }
.kd-pics { font-size: 2.4rem; line-height: 1.2; letter-spacing: 0.15em; margin: 0 0 0.4rem; }
.kd-story p { font-size: 1.12rem; }
