/* App styles on top of Pico (section 2.1). One file in regions of a fixed order, each
   opened by an anchor comment: tokens, base, header, session, today, topics, reference,
   words, lessons, log, settings. A task about a screen writes only into its region;
   shared components (buttons, tags, cards, tables, fields, the verdict banner, the bar
   of the level) live in base. Colours are tokens: no colour value outside the tokens
   region, both themes differ only in the values of the tokens. */

/* === tokens === */

/* The same in both themes: ochre, the segments of the session progress on the dark
   header, the font and the sizes. */
:root {
  --och: #E0A54A;
  --seg-ok: #8FB3EE;
  --seg-bad: #F0915F;
  --seg-now: #E0A54A;
  /* The header is dark in both themes: its main text and its secondary links
     (breadcrumbs, the topics of a lesson) are one value too. */
  --hdi: #FFFFFF;
  --hdk: #B7CDF3;

  --pico-font-family-sans-serif: "Onest", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif, var(--pico-font-family-emoji);
  --pico-font-size: 93.75%; /* 15px of body text at every width */
  --pico-border-radius: 6px;
}

/* Light: the page without data-theme="dark". The selector has the specificity of Pico's
   own light block, so these values win over it. */
:root:not([data-theme="dark"]) {
  color-scheme: light;
  --bg: #F4F5F7;
  --sf: #FFFFFF;
  --sf2: #F7F8FA;
  --ln: #DADDE3;
  --ln2: #ECEEF1;
  --ink: #1A2233;
  --mut: #5A6375;
  --fnt: #687081;
  --hd: #1C2B45;
  --hdm: #B8C2D6;
  --hdl: #2C3D5C;
  --ochi: #8A5A12;
  --ochs: #FBF1E0;
  --blu: #1C4E9C;
  --blus: #EAF0F9;
  --org: #B4471C;
  --orgi: #9A3B16;
  --orgs: #FBEEE8;
  --orgl: #E8C9B9;
  --btn: #1C2B45;
  --btni: #FFFFFF;
  --fcs: #DCE3EF;
  --yel: #C9862A;
  --gry: #8992A2;
  --trk: #C7CBD4;
}

/* Dark by the device: the theme setting is «системная», no data-theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0F141C;
    --sf: #171E29;
    --sf2: #1B2330;
    --ln: #283245;
    --ln2: #222B3A;
    --ink: #E4E8EF;
    --mut: #98A2B3;
    --fnt: #818B9A;
    --hd: #17233A;
    --hdm: #A8B4CC;
    --hdl: #26355A;
    --ochi: #E8B66A;
    --ochs: #3A2C14;
    --blu: #86AEEB;
    --blus: #17263F;
    --org: #F0915F;
    --orgi: #F5AE87;
    --orgs: #2A1A12;
    --orgl: #6B3820;
    --btn: #E4E8EF;
    --btni: #0F141C;
    --fcs: #26355A;
    --yel: #E0A54A;
    --gry: #6D788B;
    --trk: #344159;
  }
}

/* Dark by the setting: data-theme="dark" on html, put there by the server. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F141C;
  --sf: #171E29;
  --sf2: #1B2330;
  --ln: #283245;
  --ln2: #222B3A;
  --ink: #E4E8EF;
  --mut: #98A2B3;
  --fnt: #818B9A;
  --hd: #17233A;
  --hdm: #A8B4CC;
  --hdl: #26355A;
  --ochi: #E8B66A;
  --ochs: #3A2C14;
  --blu: #86AEEB;
  --blus: #17263F;
  --org: #F0915F;
  --orgi: #F5AE87;
  --orgs: #2A1A12;
  --orgl: #6B3820;
  --btn: #E4E8EF;
  --btni: #0F141C;
  --fcs: #26355A;
  --yel: #E0A54A;
  --gry: #6D788B;
  --trk: #344159;
}

/* Pico's variables take their values from the tokens, in every theme: the two
   selectors together match html with or without data-theme, each at least as specific
   as the Pico block it overrides. */
:root:not([data-theme="dark"]),
:root[data-theme="dark"] {
  --pico-background-color: var(--bg);
  --pico-color: var(--ink);
  --pico-text-selection-color: color-mix(in srgb, var(--blu) 25%, transparent);
  --pico-muted-color: var(--mut);
  --pico-muted-border-color: var(--ln2);

  --pico-primary: var(--blu);
  --pico-primary-background: var(--btn);
  --pico-primary-border: var(--btn);
  --pico-primary-underline: color-mix(in srgb, var(--blu) 50%, transparent);
  --pico-primary-hover: var(--blu);
  --pico-primary-hover-background: var(--btn);
  --pico-primary-hover-border: var(--btn);
  --pico-primary-hover-underline: var(--blu);
  --pico-primary-focus: color-mix(in srgb, var(--blu) 40%, transparent);
  --pico-primary-inverse: var(--btni);

  --pico-secondary: var(--ink);
  --pico-secondary-background: var(--sf2);
  --pico-secondary-border: var(--ln);
  --pico-secondary-underline: color-mix(in srgb, var(--mut) 50%, transparent);
  --pico-secondary-hover: var(--ink);
  --pico-secondary-hover-background: var(--ln2);
  --pico-secondary-hover-border: var(--mut);
  --pico-secondary-hover-underline: var(--mut);
  --pico-secondary-focus: color-mix(in srgb, var(--mut) 30%, transparent);
  --pico-secondary-inverse: var(--ink);

  --pico-contrast: var(--ink);
  --pico-contrast-background: var(--ink);
  --pico-contrast-border: var(--ink);
  --pico-contrast-underline: color-mix(in srgb, var(--ink) 50%, transparent);
  --pico-contrast-hover: var(--ink);
  --pico-contrast-hover-background: var(--ink);
  --pico-contrast-hover-border: var(--ink);
  --pico-contrast-hover-underline: var(--ink);
  --pico-contrast-focus: color-mix(in srgb, var(--mut) 30%, transparent);
  --pico-contrast-inverse: var(--bg);

  --pico-box-shadow: none;
  --pico-h1-color: var(--ink);
  --pico-h2-color: var(--ink);
  --pico-h3-color: var(--ink);
  --pico-h4-color: var(--ink);
  --pico-h5-color: var(--ink);
  --pico-h6-color: var(--mut);
  --pico-mark-background-color: var(--ochs);
  --pico-mark-color: var(--ochi);
  --pico-ins-color: var(--blu);
  --pico-del-color: var(--orgi);
  --pico-blockquote-border-color: var(--ln);
  --pico-blockquote-footer-color: var(--mut);

  --pico-table-border-color: var(--ln2);
  --pico-table-row-stripped-background-color: var(--sf2);
  --pico-code-background-color: var(--sf2);
  --pico-code-color: var(--mut);
  --pico-code-kbd-background-color: var(--ink);
  --pico-code-kbd-color: var(--bg);

  --pico-form-element-background-color: var(--sf);
  --pico-form-element-selected-background-color: var(--sf2);
  --pico-form-element-border-color: var(--mut);
  --pico-form-element-color: var(--ink);
  --pico-form-element-placeholder-color: var(--mut);
  --pico-form-element-active-background-color: var(--sf);
  --pico-form-element-active-border-color: var(--blu);
  --pico-form-element-focus-color: var(--fcs);
  --pico-form-element-invalid-border-color: var(--org);
  --pico-form-element-invalid-active-border-color: var(--org);
  --pico-form-element-invalid-focus-color: var(--orgs);
  --pico-form-element-valid-border-color: var(--blu);
  --pico-form-element-valid-active-border-color: var(--blu);
  --pico-form-element-valid-focus-color: var(--fcs);
  --pico-icon-valid: none;
  --pico-icon-invalid: none;

  --pico-switch-background-color: var(--gry);
  --pico-switch-checked-background-color: var(--btn);
  --pico-switch-color: var(--btni);
  --pico-range-border-color: var(--trk);
  --pico-range-active-border-color: var(--gry);
  --pico-range-thumb-border-color: var(--bg);
  --pico-range-thumb-color: var(--mut);
  --pico-range-thumb-active-color: var(--blu);

  --pico-accordion-border-color: var(--ln2);
  --pico-accordion-active-summary-color: var(--blu);
  --pico-accordion-close-summary-color: var(--ink);
  --pico-accordion-open-summary-color: var(--ink);

  --pico-card-background-color: var(--sf);
  --pico-card-border-color: var(--ln);
  --pico-card-box-shadow: none;
  --pico-card-sectioning-background-color: var(--sf2);
  --pico-dropdown-background-color: var(--sf);
  --pico-dropdown-border-color: var(--ln);
  --pico-dropdown-box-shadow: none;
  --pico-dropdown-color: var(--ink);
  --pico-dropdown-hover-background-color: var(--sf2);
  --pico-modal-overlay-background-color: color-mix(in srgb, var(--bg) 75%, transparent);
  --pico-progress-background-color: var(--trk);
  --pico-progress-color: var(--blu);
  --pico-tooltip-background-color: var(--ink);
  --pico-tooltip-color: var(--bg);
}

/* === base === */

/* Onest, one variable file with Latin and Cyrillic, weights 100 to 900; served from
   /static/fonts/ with its OFL licence next to it, no request leaves the app. */
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/onest-variable.woff2") format("woff2");
}

body {
  background-color: var(--bg);
}

/* The container: up to 1120px, margins of 32px on a laptop and 16px on a phone. Later
   than Pico's own steps of max-width, so it wins at every width. */
.container {
  max-width: 1120px;
  padding-inline: 16px;
}

@media (min-width: 576px) {
  .container {
    padding-inline: 32px;
  }
}

/* Numbers in tables line up in columns. */
table {
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* «Перевод», «Плохое задание», «Ещё»: a summary row is 16px high, padding makes
   its tap target 40px and the negative margins keep the spacing as it was. */
details > summary {
  margin-top: -0.75rem;
  margin-bottom: -0.75rem;
  padding-block: 0.75rem;
}

details[open] > summary {
  margin-bottom: calc(var(--pico-spacing) - 0.75rem);
}

/* Buttons. The main one is Pico's default: --btn with --btni text. The outline one has
   a --btn border and text. The secondary one is grey with a --ln border, 40px high.
   .btn-lg is the main button of a session: 52px, the full width. */
:is(button, [type="submit"], [type="button"], [role="button"]) {
  font-weight: 500;
}

:is(button, [type="submit"], [type="button"], [role="button"]).outline:not(.secondary, .contrast),
:is(button, [type="submit"], [type="button"], [role="button"]).outline:not(.secondary, .contrast):is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
  --pico-background-color: transparent;
  --pico-color: var(--btn);
  --pico-border-color: var(--btn);
}

:is(button, [type="submit"], [type="button"], [role="button"]).secondary {
  min-height: 40px;
}

:is(button, [type="submit"], [type="button"], [role="button"]).outline.secondary {
  --pico-border-color: var(--ln);
}

:is(button, [type="submit"], [type="button"], [role="button"]).outline.secondary:is([aria-current]:not([aria-current="false"]), :hover, :active, :focus) {
  --pico-border-color: var(--mut);
}

:is(button, [type="submit"], [type="button"], [role="button"]).btn-lg {
  width: 100%;
  min-height: 52px;
  font-size: 1.0625rem;
  font-weight: 600;
}

/* The chevron of a summary that looks like a button («Добавить слова», «Разобрать урок»):
   Pico paints it white with a filter, unseen on a grey secondary button and on the light
   main button of the dark theme. Here the chevron is a mask filled with the text colour of
   its button, in every variant and theme. The first selector is as specific as Pico's. */
details summary[role="button"]:not(.outline)::after,
details summary[role="button"].outline::after {
  filter: none;
  background-color: currentColor;
  background-image: none;
  -webkit-mask: var(--pico-icon-chevron) right center / 1rem auto no-repeat;
  mask: var(--pico-icon-chevron) right center / 1rem auto no-repeat;
}

/* The tick of a checked box (#1048, design 2026-11-03, section 93): Pico paints it
   white over the fill of --btn, which in the dark theme is the light grey of --ink, a
   contrast of 1.23:1. Here the tick is Pico's icon as a mask filled with --btni, the
   text colour on --btn: dark on the dark theme (about 15:1), white on the light one as
   before. Every checkbox of the web but a switch, and not the dash of an indeterminate
   box; as specific as Pico's :checked:focus, app.css loads later. */
[type="checkbox"]:checked:not([role="switch"], :indeterminate) {
  background-image: none;
}

[type="checkbox"]:checked:not([role="switch"], :indeterminate)::before {
  display: block;
  width: 100%;
  height: 100%;
  background-color: var(--btni);
  content: "";
  -webkit-mask: var(--pico-icon-checkbox) center / 0.75em auto no-repeat;
  mask: var(--pico-icon-checkbox) center / 0.75em auto no-repeat;
}

/* Session entry points: «Практика», «Продолжить», «Прервать». */
form.inline {
  display: inline-block;
  margin: 0;
}

form.inline button,
.practice [role="button"] {
  width: auto;
  margin: 0;
}

button.small {
  min-height: 40px; /* a comfortable tap target on a phone */
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
}

.practice {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--pico-spacing) * 0.5);
  align-items: center;
  margin-bottom: var(--pico-typography-spacing-vertical);
}

/* Tags (rule 6): «начато» ochre, «просрочено N дн.» and «слабая» orange, «новая» blue,
   a subtopic grey with a border. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  padding: 0.0625rem 0.5rem;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
  color: var(--mut);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.tag.tag-och {
  border-color: transparent;
  background: var(--ochs);
  color: var(--ochi);
}

.tag.tag-org {
  border-color: transparent;
  background: var(--orgs);
  color: var(--orgi);
}

.tag.tag-blu {
  border-color: transparent;
  background: var(--blus);
  color: var(--blu);
}

/* A card: --sf with a --ln border, no shadow. Pico's article is the card. */
article,
.card {
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
  box-shadow: none;
}

/* A table in a frame: the frame scrolls sideways, not the page; the head on --sf2,
   rows divided by --ln2. The frame is the containing block of what is positioned in
   its table (#527): a visually hidden heading of a column, absolute, stays clipped by
   the frame and does not widen the page («Слова» at 576-640px). */
.table-frame {
  position: relative;
  max-width: 100%;
  margin-bottom: var(--pico-spacing);
  overflow-x: auto;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
}

.table-frame > table {
  margin-bottom: 0;
}

.table-frame :is(th, td) {
  background-color: var(--sf);
  border-bottom: 1px solid var(--ln2);
}

.table-frame thead th {
  background-color: var(--sf2);
  color: var(--mut);
  font-weight: 600;
}

.table-frame tbody tr:last-child > :is(th, td) {
  border-bottom: 0;
}

/* The verdict banner (rule 1): right blue, a mistake in the accent ochre, wrong orange;
   the word always says it too. */
[data-verdict] .verdict {
  padding: 0.625rem 0.875rem;
  border-radius: var(--pico-border-radius);
  font-size: 1.25rem;
}

[data-verdict="correct"] .verdict {
  background: var(--blus);
  color: var(--blu);
}

[data-verdict="accent"] .verdict {
  background: var(--ochs);
  color: var(--ochi);
}

[data-verdict="wrong"] .verdict {
  background: var(--orgs);
  color: var(--orgi);
}

/* The banner goes by the credit (section 8, #2085): a wrong answer counted for a
   mistake outside the trained rule is «✓ Засчитано» in a blue outline without a fill. */
[data-verdict] .verdict.banner-counted {
  border: 1px solid var(--blu);
  background: transparent;
  color: var(--blu);
}

/* Fields: a --mut border; in focus --blu and a 3px ring of --fcs (Pico draws the ring
   from these variables). A field with an error: a 2px --org border on --orgs. */
:where(input, select, textarea):focus {
  --pico-outline-width: 3px;
}

:where(input, select, textarea)[aria-invalid="true"] {
  --pico-background-color: var(--orgs);
  border-width: 2px;
}

.form-error {
  padding: 0.5rem 0.75rem;
  border-radius: var(--pico-border-radius);
  background: var(--orgs);
  color: var(--orgi);
}

/* Admonitions: !!! warning "Типичная ошибка" and the like. A frame without the bar on
   the left; the warning has an --orgl frame and its title on --orgs in --orgi. */
.admonition {
  margin-bottom: var(--pico-typography-spacing-vertical);
  padding: calc(var(--pico-spacing) * 0.75) var(--pico-spacing);
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background-color: var(--sf2);
}

.admonition > :last-child {
  margin-bottom: 0;
}

.admonition-title {
  margin-bottom: calc(var(--pico-spacing) * 0.5);
  font-weight: 600;
}

.admonition.warning {
  padding-top: 0;
  overflow: hidden;
  border-color: var(--orgl);
  background-color: var(--sf);
}

.admonition.warning .admonition-title {
  margin: 0 calc(var(--pico-spacing) * -1) calc(var(--pico-spacing) * 0.75);
  padding: calc(var(--pico-spacing) * 0.5) var(--pico-spacing);
  background-color: var(--orgs);
  color: var(--orgi);
}

/* The bar of the level (section 11, #225): MAX_STEP segments filled by the step of
   the schedule, coloured by the recent accuracy. A segment fills to --fill (0 to 1),
   set inline; the colour comes from data-color, the names stay semantic and the
   palette is rule 1 of section 2.1: green is --blu, yellow --yel, red --org, grey --gry,
   empty --trk. Only the passed part has a colour: the unfilled part is the neutral
   track --trk in every colour, so a red bar at step 0 is empty, not six pale orange
   segments; the inaccuracy is a word next to the bar, «неточно» on «Слова» (#1194,
   docs/ios.md 7.21, 86). The bar of a word uses the same classes. */
.level-bar {
  --level-fill: var(--gry);
  --level-rest: var(--trk);
  display: inline-flex;
  flex: none;
  gap: 2px;
}

.level-bar[data-color="green"] {
  --level-fill: var(--blu);
}

.level-bar[data-color="yellow"] {
  --level-fill: var(--yel);
}

.level-bar[data-color="red"] {
  --level-fill: var(--org);
}

.level-bar[data-color="grey"] {
  --level-fill: var(--gry);
}

.level-bar[data-color="empty"] {
  --level-fill: var(--trk);
}

/* «неточно» beside the bar of a word after a mistake in the latest attempt (#1194):
   the colour of the bar is only on its passed segments, so a word at step 0 says it in
   a word, orange as the bar. Wherever the bar of a word shows: «Слова», the result of a
   word, the summary of a session. */
.level-inexact {
  margin-left: 6px;
  color: var(--org);
  font-size: 0.875rem;
  vertical-align: middle;
}

.level-bar > i {
  width: 1rem;
  height: 0.5rem;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--level-fill) calc(var(--fill) * 100%),
    var(--level-rest) 0
  );
}

.mastery {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.5em;
  color: var(--pico-muted-color);
}

.mastery .trend {
  font-weight: 600;
}

.mastery [data-trend-arrow="up"] {
  color: var(--blu);
}

.mastery [data-trend-arrow="down"] {
  color: var(--org);
}

.mastery [data-weak] {
  color: var(--org);
}

/* Safari on the iPhone zooms the page in on a field whose text is under 16px, and the
   root of 93.75% makes it 15px: the card loses its margin, the compact session header
   (#318) runs off the screen, and the zoom stays after the keyboard closes. On a phone
   every text field, textarea and select is 16px, over what a screen sets for its own
   fields (hence !important); radios and checkboxes have no text. A laptop does not
   zoom and is left as it was. */
@media (max-width: 575.98px) {
  input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"]),
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* The lock of a closed subtopic (v40, #1479): a stroke icon in the colour of its text,
   on the topics map and on the page of a topic. */
.lock-icon {
  flex: none;
  vertical-align: -2px;
  margin-inline-end: 4px;
}

/* «Как работает повторение» (section 9.1, v42, #1591): a quiet foldout shared by the
   topics map and the summary of a session, its summary a muted link-like line, the
   text in the width of reading. */
.repetition-help {
  max-width: 640px;
  font-size: 0.875rem;
}

/* A tap target of 44px, as the other foldouts on a phone; the negative margins of
   details > summary keep the spacing. */
.repetition-help > summary {
  box-sizing: border-box;
  min-height: 44px;
  color: var(--mut);
}

.repetition-help > p {
  margin: 0 0 8px;
  color: var(--ink);
  line-height: 1.5;
}

/* The place a link of the search lands on (section 11, v44): its text on --blus in
   --blu for a second, then it fades, as a heading jumped to by an anchor (app.js puts
   the mark around the match). */
mark.search-flash {
  padding: 0;
  background-color: var(--blus);
  color: var(--blu);
  transition:
    background-color 0.6s ease,
    color 0.6s ease;
}

mark.search-flash.search-flash-done {
  background-color: transparent;
  color: inherit;
}

/* === header === */

/* The header (#277): a band of --hd, dark in both themes, whose colour theme-color of
   base.html repeats. The status bar of the iPhone lies over the page
   (black-translucent): the header steps down by the safe area. The session screens put
   their own header into the same band. */
body > header {
  padding-top: env(safe-area-inset-top);
  padding-bottom: 0;
  background-color: var(--hd);
  color: var(--hdm);
}

/* The row of the sections is a header of its own and sticks to the top of the screen on
   every page with the shared header (v10, #328), on a phone under the band of the
   status bar: this row steps down by the safe area, and --viewport-top (app.js) follows
   Safari when it shifts the visible area down. Under that band, above the content and
   the pinned parts of the pages (the form of «Разбор урока», z-index 10). No shadow and
   no line of its own: the second row, the title of the page, goes on in the same band
   right under it and scrolls away. */
body > .site-top {
  position: sticky;
  top: var(--viewport-top, 0px);
  z-index: 25;
}

/* The safe area is already kept clear above the title by the row of the sections. */
body > .site-top + .site-header {
  padding-top: 0;
}

/* The height of the row of the sections: its links are as high as the row. */
:root {
  --site-bar: 52px;
}

/* A heading jumped to by an anchor, or any element scrolled into view, stops under the
   sticky row and its safe area, not behind them; its own scroll-margin-top stays the
   air under the row. Only on pages with the row: the session screens are untouched. */
html:has(> body > .site-top) {
  scroll-padding-top: calc(var(--site-bar) + env(safe-area-inset-top, 0px));
}

/* The band under the status bar of the iPhone (#315): as high as the safe area and of
   the colour of the header, fixed over the page, so a scrolled page never shows its
   content under the clock. Above the session header and the pinned buttons; at the top
   of what is seen when Safari shifts the visible area down (--viewport-top, app.js).
   Without a safe area (a laptop) it has no height. */
body::before {
  content: "";
  position: fixed;
  top: var(--viewport-top, 0px);
  right: 0;
  left: 0;
  z-index: 30;
  height: env(safe-area-inset-top, 0px);
  background-color: var(--hd);
  pointer-events: none;
}

/* What lies outside the page on the iPhone (#343). The canvas is of the header colour:
   iOS 26 in standalone shades the status bar with the background of the page itself
   (a light one gives a grey gradient over the header and black clocks), and Safari
   fills the area pulled out above the page by it. The page itself stays --bg: body of
   the base region paints it over everything. A fixed backdrop under the page,
   --hd in its upper half and --bg in its lower one, is what the bounce reveals: over
   the header when the page is pulled down at its top, the page colour under the
   content when it is pulled up at its bottom. color-scheme stays the theme's, so the
   fields of the light theme stay light. The page is at least as high as the screen, so
   on a short one neither the canvas nor the upper half of the backdrop shows. Only on a
   touch screen and in standalone (#402): on a laptop the bounce of the trackpad showed
   the header colour over the content, so there the canvas is --bg and no backdrop. */
html {
  background-color: var(--bg);
}

body {
  min-height: 100dvh;
}

@media (pointer: coarse), (display-mode: standalone) {
  html {
    background-color: var(--hd);
  }

  body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(var(--hd) 50%, var(--bg) 50%);
    pointer-events: none;
  }
}

body > header h1 {
  margin: 0;
  color: var(--hdi);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
}

/* The first row: «EXTRA·CLASE» on the left, the sections on the right. A link of a
   section is as high as the row, so the ochre line of the current one lies on its
   bottom edge. The selectors outweigh Pico's nav ul:first-of-type and nav li a. */
.site-bar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
}

.site-bar .brand {
  align-self: center;
  color: var(--hdi);
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.site-bar .brand-dot {
  color: var(--och);
}

.site-nav {
  align-items: stretch;
}

.site-nav .nav-links {
  flex-wrap: nowrap;
  align-items: stretch;
  margin: 0;
}

.site-nav .nav-links li {
  display: flex;
  padding: 0;
}

.site-nav .nav-link {
  display: flex;
  align-items: center;
  min-height: var(--site-bar);
  margin: 0;
  padding: 3px 12px 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--hdm);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav .nav-link:hover {
  color: var(--hdi);
}

.site-nav .nav-link[aria-current="page"] {
  border-bottom-color: var(--och);
  color: var(--hdi);
  font-weight: 600;
}

.site-nav .nav-gear {
  display: none;
}

/* Between the phone and a laptop (#527): the brand, the gap and six sections at their
   laptop paddings are 571px, wider than the row of a window of 576-634px with its
   margins of 32px, so the page scrolled sideways by up to 27px (2-3px at 600-601px).
   Tighter paddings and gap there keep the row within 512px; under 576px and from 768px
   the row is as before. «EXTRA·CLASE» (#2014) is 13px wider than «ESPAÑOL·A1»: a pixel
   less of padding on each side of the six sections keeps the row 511px. */
@media (min-width: 576px) and (max-width: 767.98px) {
  .site-bar {
    gap: 12px;
  }

  .site-nav .nav-link {
    padding-inline: 7px;
  }
}

/* The second row: the title of the page with a short line of context above it and the
   summary numbers or the main button of the page on the right. The line between the rows
   is its top edge, so the sticky row above has none of its own. */
.page-head {
  border-top: 1px solid var(--hdl);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 20px 24px;
}

.page-heading {
  min-width: 0;
}

.page-context,
.page-context p {
  margin: 0 0 4px;
  color: var(--hdm);
  font-size: 0.875rem;
}

/* The line under the title: what a session is over on its summary (#1368). */
.page-caption {
  margin: 4px 0 0;
  color: var(--hdm);
  font-size: 0.875rem;
}

/* The line of a lesson keeps its own look elsewhere. */
.page-context .lesson-meta {
  margin: 0 0 4px;
  color: var(--hdm);
  font-size: 0.875rem;
}

/* Secondary links of the header: breadcrumbs, the topics of a lesson. */
.page-context a {
  color: var(--hdk);
  text-decoration-color: var(--hdk);
}

/* The header of a session screen: the title and the progress in the same band. */
.session-header .container {
  padding-block: 12px 16px;
}

.session-header .session-exit {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--hdk);
  font-size: 0.875rem;
  text-decoration: none;
}

.session-header hgroup {
  margin: 0;
}

.session-header hgroup > p {
  margin: 4px 0 0;
  color: var(--hdm);
}

/* A phone (narrower than 576px): five sections as text of 14px and the gear of
   «Настройки» of 44x44, in one row without wrapping; the brand gives way to them. */
@media (max-width: 575.98px) {
  :root {
    --site-bar: 44px;
  }

  body > header h1 {
    font-size: 24px;
  }

  .site-bar .brand {
    display: none;
  }

  .site-nav {
    flex: 1;
  }

  .site-nav .nav-links {
    flex: 1;
    justify-content: space-between;
  }

  .site-nav .nav-link {
    padding-inline: 4px;
    font-size: 14px;
  }

  .site-nav .nav-settings .nav-link {
    justify-content: center;
    width: 44px;
    padding-inline: 0;
  }

  .site-nav .nav-settings .nav-label {
    display: none;
  }

  .site-nav .nav-gear {
    display: block;
  }

  .page-head {
    padding-block: 12px 16px;
  }
}

/* The field of the search over everything (section 11, v44, #1662): from 1024px in the
   row of the sections between the brand and them, narrower on a line of its own above
   the title, the whole width, 44px high. Pico's pill with its magnifier, coloured as
   the dark band rather than the page. */
.site-search {
  margin: 0;
}

.site-search input[type="search"] {
  margin: 0;
  border: 1px solid var(--hdl);
  background-color: var(--hdl);
  color: var(--hdi);
  font-size: 0.9375rem;
}

.site-search input[type="search"]::placeholder {
  color: var(--hdm);
  opacity: 1;
}

.site-search input[type="search"]:focus {
  border-color: var(--hdk);
  box-shadow: 0 0 0 2px var(--hdk);
}

.site-search-bar {
  display: none;
  flex: 1 1 14rem;
  align-self: center;
  max-width: 22rem;
}

.site-search-bar input[type="search"] {
  height: 36px;
  padding-block: 0;
}

.site-search-row {
  padding-block: 8px;
}

.site-search-row input[type="search"] {
  height: 44px;
}

@media (min-width: 1024px) {
  .site-search-bar {
    display: block;
  }

  .site-search-row {
    display: none;
  }
}

/* The page of the search (section 11): the exact match, then the groups in columns as
   wide as the room allows on a laptop, one under another on a phone. A row is a link
   and lines under it; the place of the match is --blus with the text --blu, as in the
   native client. */
.search-page {
  margin-block: var(--pico-spacing) calc(var(--pico-spacing) * 2);
}

.search-hint,
.search-empty p {
  color: var(--mut);
}

.search-empty p strong {
  color: var(--ink);
}

.search-exact {
  margin-bottom: calc(var(--pico-spacing) * 1.5);
  padding: 12px 16px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
}

.search-exact h2,
.search-group h2 {
  margin: 0 0 8px;
  color: var(--mut);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search-count {
  margin-left: 4px;
  color: var(--ink);
}

.search-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: calc(var(--pico-spacing) * 1.5);
}

.search-groups-one {
  grid-template-columns: 1fr;
  max-width: 48rem;
}

.search-group {
  min-width: 0;
  margin: 0;
}

.search-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.search-rows .search-row {
  margin: 0;
  padding: 10px 0;
  border-top: 1px solid var(--ln2);
  list-style: none;
  overflow-wrap: anywhere;
}

.search-rows .search-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.search-row .search-title {
  display: inline-block;
  color: var(--ink);
  font-weight: 600;
}

.search-row a.search-title {
  color: var(--blu);
  text-decoration: none;
}

.search-row a.search-title:hover {
  text-decoration: underline;
}

.search-row .search-meta,
.search-row .search-form {
  display: block;
  margin-top: 2px;
  color: var(--mut);
  font-size: 0.8125rem;
}

.search-row .search-translation {
  display: block;
  color: var(--ink);
}

.search-row .search-excerpt {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--ink);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.search-locked .lock-icon {
  margin-right: 2px;
  vertical-align: -2px;
}

mark.search-hit {
  padding: 0 1px;
  border-radius: 2px;
  background: var(--blus);
  color: var(--blu);
}

/* A form of the verb table folds out its six forms, as the result of a drill. */
.search-verb > summary {
  display: block;
  min-height: 24px;
  margin: 0;
  color: var(--ink);
}

.search-verb > summary .search-meta {
  display: inline;
}

.search-verb-name {
  margin: 8px 0 4px;
  color: var(--mut);
  font-size: 0.8125rem;
}

.search-verb-table {
  width: 100%;
  margin: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.search-verb-table td {
  padding: 6px 8px;
  border: 1px solid var(--ln2);
  background: var(--sf);
  color: var(--ink);
  font-size: 0.9375rem;
}

.search-verb-table td.verb-table-asked {
  background: var(--blus);
  color: var(--blu);
}

.search-verb-table .verb-table-pronoun {
  margin-right: 6px;
  color: var(--mut);
  font-size: 0.8125rem;
}

.search-all {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--blu);
  font-size: 0.9375rem;
}

/* «Админка ↗» of the header of the public site (docs/multiuser.md 10.22, items 3-6,
   section 190; #2040): to an admin by his row alone, last in the row of the sections in
   ochre, on a phone a shield of 44x44 beside the gear. A button of a form, as a link of
   the row looks. Under it the box of the check of Tailscale («Проверяю…», then the
   refusal with «Повторить» and «Закрыть»), on a phone a card at the bottom. */
.site-nav .nav-admin {
  position: relative;
}

.site-nav .nav-admin-form {
  display: flex;
  margin: 0;
}

.site-nav .nav-admin-link {
  width: auto;
  height: auto;
  border-width: 0 0 3px;
  border-color: transparent;
  background: none;
  box-shadow: none;
  color: var(--och);
  font: inherit;
  font-weight: 600;
  line-height: inherit;
  cursor: pointer;
}

.site-nav .nav-admin-link:hover,
.site-nav .nav-admin-link:active {
  border-color: transparent;
  background: none;
  color: var(--och);
}

.site-nav .nav-admin-link:focus-visible {
  box-shadow: inset 0 0 0 2px var(--hdk);
}

.site-nav .nav-shield {
  display: none;
}

.admin-check {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 26;
  width: 320px;
  padding: 14px;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--ink) 18%, transparent);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  white-space: normal;
}

.admin-check:has(.admin-check-fail:not([hidden])) {
  border-color: var(--orgl);
}

.admin-check p {
  margin: 0;
}

.admin-check-text {
  font-weight: 600;
}

.admin-check-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid var(--ln);
  border-top-color: var(--blu);
  border-radius: 50%;
  vertical-align: -2px;
  animation: check-spin 0.8s linear infinite;
}

.admin-check-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* As specific as Pico's nav li [type="button"], which would give them its padding. */
.admin-check .admin-check-actions button {
  width: auto;
  height: 36px;
  margin: 0;
  padding: 0 14px;
  font-size: 13.5px;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .admin-check-spin {
    animation-duration: 2.4s;
  }
}

/* Between the phone and a laptop (the band of #527): the six sections already fill the
   row, so the item is the shield and «EXTRA·CLASE» gives way to it, as on a phone; with
   the label the row was 606px in 512px and the page scrolled sideways. */
@media (min-width: 576px) and (max-width: 767.98px) {
  .site-bar:has(.nav-admin) .brand {
    display: none;
  }

  .site-bar:has(.nav-admin) .site-nav {
    margin-left: auto;
  }

  .site-nav .nav-admin-link {
    justify-content: center;
    width: 44px;
    padding-inline: 0;
  }

  .site-nav .nav-admin .nav-label {
    display: none;
  }

  .site-nav .nav-shield {
    display: block;
  }
}

/* A phone: the shield before the gear, the box a card above the bottom of the screen,
   its buttons of 44px. */
@media (max-width: 575.98px) {
  .site-nav .nav-links:has(> .nav-admin) > .nav-settings {
    order: 2;
  }

  .site-nav .nav-admin {
    order: 1;
  }

  .site-nav .nav-admin-link {
    justify-content: center;
    width: 44px;
    padding-inline: 0;
  }

  .site-nav .nav-admin .nav-label {
    display: none;
  }

  .site-nav .nav-shield {
    display: block;
  }

  .admin-check {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    width: auto;
  }

  .admin-check .admin-check-actions button {
    height: 44px;
  }
}

/* === session === */

/* The header of a session screen (section 8, #278), in the band of the shared one:
   «←» that aborts the session, the title and the count, then a segment per item. On a
   phone the count is «N / M», on a laptop «Упражнение N из M». */
.session-header .container {
  padding-block: 4px 12px;
}

.session-header .session-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-header .session-abort {
  flex: none;
  margin: 0;
}

.session-header .session-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0 0 0 -12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--hdi);
  font-size: 1.375rem;
  line-height: 1;
}

.session-header .session-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-header .session-count {
  flex: none;
  margin: 0;
  color: var(--hdm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.session-header .count-short {
  display: none;
}

/* The kinds of an own session under the title (section 8, v17), in line with it. */
.session-header .session-kinds {
  margin: -6px 0 0 32px;
  overflow: hidden;
  color: var(--hdm);
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* On a phone the session header sticks to the top (#315): when the answer field is
   raised above the keyboard, the header stays in view under the status bar, which its
   padding of the safe area keeps clear. --viewport-top (app.js) follows Safari when it
   shifts the visible area down. Under the band of the status bar, above the pinned
   buttons. */
@media (max-width: 575.98px) {
  body > .session-header {
    position: sticky;
    top: var(--viewport-top, 0px);
    z-index: 25;
  }
}

/* The segments of the progress (section 2.1, rule 2): counted --seg-ok, not counted
   --seg-bad, the current one --seg-now, ahead and skipped --hdl. Twenty and more are
   thinner. */
.session-header .segments {
  display: flex;
  gap: 4px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.session-header .segments > .segment {
  flex: 1;
  height: 6px;
  margin: 0;
  border-radius: 2px;
  background: var(--hdl);
  list-style: none;
}

.session-header .segments:has(> :nth-child(20)) {
  gap: 2px;
}

.session-header .segments:has(> :nth-child(20)) > .segment {
  height: 4px;
}

.session-header .segment[data-state="ok"] {
  background: var(--seg-ok);
}

.session-header .segment[data-state="bad"] {
  background: var(--seg-bad);
}

.session-header .segment[data-state="now"] {
  background: var(--seg-now);
}

@media (max-width: 575.98px) {
  .session-header .session-title {
    font-size: 16px;
  }

  .session-header .count-long:not(:only-child) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .session-header .count-short {
    display: inline;
  }
}

/* While the answer is typed above the keyboard (the class compact, app.js, #318), the
   session header on a phone is one row: the segments and «N / M», without the title
   and «←», so the prompt stays in view between it and «Проверить», which is 44px high
   instead of 52. When the keyboard closes, both are back. */
@media (max-width: 575.98px) {
  .session-header.compact .container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-block: 8px;
  }

  .session-header.compact .session-abort,
  .session-header.compact .session-title,
  .session-header.compact .session-kinds {
    display: none;
  }

  .session-header.compact .session-bar {
    flex: none;
    order: 1;
  }

  .session-header.compact .segments {
    flex: 1;
    margin: 0;
  }

  body:has(> .session-header.compact) .exercise .answer-actions [data-check] {
    min-height: 44px;
    height: 44px;
    padding-block: 0;
  }
}

/* The card of the task: the instruction grey and bold, the phrase large, the
   translation on --sf2 under «Перевод». */
.exercise .prompt {
  margin-bottom: 12px;
  font-size: 22px;
  font-weight: 500;
  line-height: 1.35;
}

@media (min-width: 576px) {
  .exercise .prompt {
    font-size: 28px;
  }
}

/* The subtopic of the exercise in «Работа над ошибками», above everything else. */
.exercise .subtopic {
  margin-bottom: 0.25rem;
  color: var(--pico-muted-color);
}

/* What to do with the phrase, above the prompt. */
.exercise .instruction {
  margin-bottom: 0.5rem;
  color: var(--mut);
  font-weight: 600;
}

/* «исправь свою ошибку»: the instruction on --orgs, the past answer underlined with a
   wave of --org. */
.exercise .instruction[data-own-error] {
  padding: 8px 12px;
  border-radius: var(--pico-border-radius);
  background: var(--orgs);
  color: var(--orgi);
}

.exercise mark[data-shown-answer] {
  padding: 0;
  background: transparent;
  color: inherit;
  text-decoration: underline wavy var(--org);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

/* transform: the condition from the parentheses as an ochre tag. */
.exercise .prompt .condition {
  font-size: 15px;
  vertical-align: 0.2em;
}

/* transform with a frame of the answer (section 8, #1651): the new phrase with the
   blank on a line of its own under the phrase and the condition, as large as the
   phrase of a fill. */
.exercise .prompt .prompt-frame {
  display: block;
  margin-top: 6px;
}

/* «Перевод»: a 44px tap target on a phone, 20px of line and 12px above and below; the
   negative margins keep the spacing of the card. */
.exercise .hint > summary {
  margin-top: -12px;
  margin-bottom: -12px;
  padding-block: 12px;
  line-height: 20px;
}

.exercise .hint[open] > summary {
  margin-bottom: calc(var(--pico-spacing) - 12px);
}

.exercise .hint > p {
  padding: 8px 12px;
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
}

/* listen (section 8, v17): «▶ Прослушать» 44px in place of the phrase; once answered
   the phrase is shown and the button under it is smaller, 40px. The line of a failure
   under the button, «Повторить» a link with a tap target of 44px on a phone. Without
   JS the player of the browser stays, across the card. */
.exercise .listen {
  margin-bottom: 12px;
}

.exercise .listen-answered .prompt {
  margin-bottom: 8px;
}

.exercise .listen-play[hidden],
.exercise .listen-status[hidden],
.exercise .listen-player audio[hidden] {
  display: none;
}

.exercise .listen-player audio {
  display: block;
  width: 100%;
}

/* The same button under the rows of a result and on the back of a card recall
   (#1393): the sound of the right phrase or of the word. */
.exercise .result-audio {
  margin: 0 0 16px;
}

.exercise .word-audio {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 8px 0 0;
}

.exercise .word-audio .listen-status {
  justify-content: center;
  text-align: center;
}

.exercise .listen-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0 18px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.exercise .listen-player-small .listen-play {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.exercise .listen-play[data-listen-state="loading"] {
  color: var(--mut);
}

.exercise .listen-icon {
  color: var(--blu);
  font-size: 0.875em;
}

.exercise .listen-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
  margin: 4px 0 0;
  color: var(--org);
  font-size: 0.875rem;
}

.exercise .listen-status a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

@media (min-width: 576px) {
  .exercise .listen-status a {
    min-height: auto;
  }
}

/* «Переозвучить» next to «▶ Прослушать» of a listen phrase and of the right phrase of a
   result (section 13.2, #1572): a link in a row with the button, a tap target of the
   height of the button; «Переозвучиваю…» while the request runs; «Переозвучено» and
   the reason of a failure under them, the failure in the colour of the line of a failed
   playing. */
.exercise .exercise-voice {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: 16px;
}

.exercise .exercise-voice-answer {
  margin: 0 0 16px;
}

.exercise .exercise-voice .result-audio {
  margin: 0;
}

.exercise .exercise-revoice {
  margin: 0;
}

.exercise .exercise-revoice-link {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--mut);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1;
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
}

.exercise .listen-player-small ~ .exercise-revoice .exercise-revoice-link {
  min-height: 40px;
}

.exercise .exercise-revoice-link:hover,
.exercise .exercise-revoice-link:focus-visible {
  color: var(--ink);
}

.exercise .exercise-revoice-link:focus-visible {
  outline: 2px solid var(--fcs);
  outline-offset: 2px;
}

.exercise .exercise-revoice-wait,
.exercise .exercise-revoice.htmx-request .exercise-revoice-idle {
  display: none;
}

.exercise .exercise-revoice.htmx-request .exercise-revoice-wait {
  display: inline;
}

.exercise .exercise-revoice-link:disabled {
  opacity: 1;
  color: var(--mut);
  cursor: progress;
}

.exercise :is(.exercise-voice-status, .exercise-voice-error) {
  flex-basis: 100%;
  margin: 4px 0 calc(var(--pico-spacing) * 0.75);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

/* A new press: the lines of the press before go while it runs. */
.exercise
  .exercise-voice:has(.exercise-revoice.htmx-request)
  :is(.exercise-voice-status, .exercise-voice-error) {
  display: none;
}

.exercise .exercise-voice-status {
  color: var(--mut);
}

/* respond and dictation, the conversation (section 8, #1736; _talk.html): the format
   and the instruction of a respond in one line above it, the format in --ink. Each part
   a bubble of 48px with its mark, its sound track (a bar of progress, --trk filled with
   --blu as it plays) and its length: the first line on the left on --sf2, the second
   on the right on --blus, the question a dashed bubble on --sf; the part playing
   outlined in --blu. The bubbles of the lines take 74% of the card on a phone and 62%
   from 576px. Under them the player: «▶» 52px, «Прослушать всё» and the number of the
   parts, «обычно · медленно» on the right, the pressed one filled with --btn; 44px at
   a dictation answered. Without JS each bubble keeps its mark and the player of the
   browser, the player and the bubbles to press are hidden. Once answered the card
   of a respond keeps no sound: the conversation of the result has it. */
.exercise .respond-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 6px;
  margin: 0 0 12px;
  color: var(--mut);
  font-size: 0.875rem;
}

.exercise .respond-line .respond-format {
  color: var(--ink);
  font-weight: 600;
}

.respond-format-icon,
.summary-respond-icon {
  flex: none;
  color: var(--mut);
}

.exercise .respond {
  margin-bottom: 12px;
}

.exercise .respond-answered {
  display: none;
}

.talk {
  margin: 0 0 12px;
}

.talk .talk-bubble[hidden],
.talk .talk-plain[hidden],
.talk .talk-player[hidden],
.talk .talk-sound[hidden],
.talk .listen-status[hidden],
.talk audio[hidden] {
  display: none;
}

.talk-parts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.talk-part {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.talk-right {
  justify-content: flex-end;
}

.talk .talk-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 74%;
  min-height: 48px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--ln);
  border-radius: 16px 16px 16px 4px;
  background: var(--sf2);
  color: var(--ink);
  font: inherit;
  text-align: left;
  box-shadow: none;
}

.talk .talk-right .talk-bubble {
  border-color: var(--blus);
  border-radius: 16px 16px 4px 16px;
  background: var(--blus);
}

.talk .talk-question .talk-bubble {
  width: auto;
  min-width: min(100%, 220px);
  max-width: 100%;
  border: 1px dashed var(--fnt);
  border-radius: 12px;
  background: var(--sf);
}

.talk button.talk-bubble {
  cursor: pointer;
}

.talk button.talk-bubble:focus-visible {
  outline: 2px solid var(--blu);
  outline-offset: 2px;
}

.talk .talk-part[data-playing] .talk-bubble {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--blu);
}

.talk-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sf);
  box-shadow: 0 0 0 1px var(--ln);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
}

.talk-right .talk-mark {
  background: var(--blu);
  box-shadow: none;
  color: var(--btni);
}

.talk-question .talk-mark {
  background: var(--btn);
  box-shadow: none;
  color: var(--btni);
}

.talk-track {
  display: block;
  flex: 1 1 80px;
  min-width: 60px;
  height: 6px;
  border-radius: 3px;
  background: var(--trk);
  overflow: hidden;
}

.talk-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blu);
  transition: width 0.25s linear;
}

.talk-time {
  flex: none;
  min-width: 2.25em;
  color: var(--mut);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.talk-bubble[data-listen-state="loading"] .talk-time {
  visibility: hidden;
}

.talk-plain {
  align-items: center;
  gap: 10px;
}

.talk-plain audio {
  display: block;
  flex: 1;
  min-width: 0;
  width: 100%;
}

.talk-player {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.talk .talk-play {
  display: flex;
  align-items: center;
  gap: 12px;
  width: auto;
  min-height: 52px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.talk .talk-play:focus-visible {
  outline: 2px solid var(--blu);
  outline-offset: 2px;
}

.talk-play-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--btn);
  color: var(--btni);
  font-size: 1.125rem;
}

.talk-play-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.talk-play-label {
  font-size: 1rem;
  font-weight: 600;
}

.talk .talk-play[data-listen-state="loading"] .talk-play-label {
  color: var(--mut);
}

.talk-play-caption {
  color: var(--mut);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.talk .talk-speed {
  display: flex;
  flex: none;
  width: auto;
  margin: 0 0 0 auto;
  border: 1px solid var(--ln);
  border-radius: 8px;
  overflow: hidden;
}

.talk .talk-speed button {
  flex: none;
  width: auto;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background: var(--sf);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  box-shadow: none;
}

.talk .talk-speed button[aria-pressed="true"] {
  background: var(--btn);
  color: var(--btni);
  font-weight: 600;
}

.talk .talk-speed button:focus-visible {
  outline: 2px solid var(--blu);
  outline-offset: -2px;
}

.talk-small .talk-parts {
  margin-bottom: 8px;
}

.talk-small .talk-play-icon {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

.talk-small .talk .talk-play,
.talk-small.talk .talk-play {
  min-height: 44px;
}

/* A dictation: the conversation across the line, «Переозвучить» under it. */
.exercise .exercise-voice-listen .talk {
  flex: 1 1 100%;
}

@media (min-width: 576px) {
  .talk .talk-bubble {
    width: 62%;
  }
}

.exercise .respond-question {
  margin: 12px 0 0;
}

.exercise .respond-question > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--blu);
  font-size: 0.9375rem;
  font-weight: 500;
}

.exercise .respond-question .prompt {
  margin: 4px 0 0;
  padding: 8px 12px;
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
}

.exercise .gloss-pop .gloss-ru {
  color: var(--mut);
}

.exercise .exercise-voice-error {
  color: var(--org);
}

/* A cell of the drill: the infinitive large in the middle, the tense under it, the
   person with the blank and the field centred. */
.exercise-cell .cell-infinitive {
  margin: 8px 0 0;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.exercise-cell .cell-tense {
  margin: 0 0 12px;
  color: var(--mut);
  text-align: center;
}

.exercise-cell .prompt,
.exercise-cell .field-label {
  text-align: center;
}

.exercise-cell #answer-field {
  display: block;
  max-width: 20rem;
  margin-inline: auto;
  text-align: center;
}

/* A cell with a time marker and phrases (section 5.5, v32): the marker bold in the line
   of the person, without colour; the phrase of the person under it at once, in place
   of «Перевод». */
.exercise-cell .cell-marker {
  font-weight: 700;
}

.exercise-cell .cell-phrase {
  margin: 0 0 var(--pico-spacing);
  color: var(--mut);
  text-align: center;
}

/* The caption of the answer field, by the kind. */
.exercise .field-label {
  margin-bottom: 4px;
  color: var(--mut);
  font-size: 0.875rem;
  font-weight: 600;
}

/* translate: two lines, Enter sends (app.js); the notes under it. The rest of checks
   is a laptop line. */
.exercise textarea[data-translate-answer] {
  resize: none;
}

.exercise .field-note,
.exercise .checks-left {
  margin-top: -8px;
  margin-bottom: 8px;
  color: var(--mut);
  font-size: 0.875rem;
}

.exercise .field-note + .checks-left {
  margin-top: 0;
}

/* The voice input (section 8, #19, #431): a 44px button right of the field, shown by
   app.js only where the browser records; the field takes the rest of the line, at
   390px too, the caption above both. Recording, the microphone gives way to a dot in
   --org and the seconds stand under the button; the line under the field says
   «Распознаю…» or the error. */
.exercise .voice-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.exercise .voice-row > textarea,
.exercise .voice-row > input {
  flex: 1;
  min-width: 0;
}

/* A one-line field: the button stands level with it, centred on its height. */
.exercise .voice-row-line .voice-side {
  margin-top: calc((var(--pico-line-height) * 1rem + var(--pico-form-element-spacing-vertical) * 2 + var(--pico-border-width) * 2 - 44px) / 2);
}

/* A drill cell: the field and the button centred together. */
.exercise-cell .voice-row {
  justify-content: center;
}

.exercise-cell .voice-row > #answer-field {
  margin-inline: 0;
}

.exercise .voice-side {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.exercise .voice-side[hidden],
.exercise .voice-seconds[hidden],
.exercise .voice-status[hidden] {
  display: none;
}

.exercise .voice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ln);
  border-radius: 50%;
  background: var(--sf);
  color: var(--ink);
  line-height: 1;
}

.exercise .voice-btn:hover,
.exercise .voice-btn:focus-visible {
  border-color: var(--blu);
  background: var(--sf2);
}

.exercise .voice-btn .voice-dot {
  display: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--org);
}

.exercise .voice-btn[data-voice-state="recording"] {
  border-color: var(--org);
  background: var(--orgs);
}

.exercise .voice-btn[data-voice-state="recording"] .voice-icon {
  display: none;
}

.exercise .voice-btn[data-voice-state="recording"] .voice-dot {
  display: block;
}

.exercise .voice-btn:disabled {
  opacity: 0.6;
}

.exercise .voice-seconds {
  color: var(--mut);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.exercise .voice-status {
  margin-top: -8px;
  margin-bottom: 8px;
  color: var(--mut);
  font-size: 0.875rem;
}

.exercise .voice-status[data-voice-error] {
  color: var(--pico-del-color);
}

.exercise .voice-status + .field-note {
  margin-top: 0;
}

/* «сказано» next to «Ваш ответ» of a spoken answer (#19). */
.result-rows .result-said {
  display: block;
  color: var(--mut);
  font-size: 0.75rem;
  font-weight: 400;
}

/* choose: rows of 54px with the number of the key on the left; the chosen one has a
   2px --blu border on --blus. The radio stays for the keyboard, unseen. */
.exercise .options legend {
  margin-bottom: 8px;
  color: var(--mut);
  font-size: 0.875rem;
  font-weight: 600;
}

.exercise .options label {
  display: flex;
  position: relative;
  gap: 12px;
  align-items: center;
  width: 100%; /* Pico fits a label with a radio to its content */
  min-height: 54px;
  margin-bottom: 8px;
  padding: 0 15px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
  cursor: pointer;
}

.exercise .options label:has(input:checked) {
  padding-inline: 14px;
  border: 2px solid var(--blu);
  background: var(--blus);
}

.exercise .options label:has(input:focus-visible) {
  outline: 3px solid var(--fcs);
}

.exercise .options input[type="radio"] {
  position: absolute;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.exercise .options kbd {
  min-width: 1.75em;
  padding: 0.125em 0.375em;
  border: 1px solid var(--ln);
  background: var(--sf2);
  color: var(--mut);
  text-align: center;
}

/* order: the line being assembled has a dashed frame, its chips are blue and a caret
   blinks after the last one, or at the insertion point; a used chip stays in the bank,
   dashed and faint (app.js).
   Without the script the chips are a plain list of the words to type. */
.exercise .order-line,
.exercise .order-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: var(--pico-spacing);
}

.exercise .order-line {
  align-items: center;
  column-gap: 10px; /* a gap wide enough to tap for the insertion point */
  min-height: 3.75rem;
  margin-bottom: 4px;
  padding: 8px;
  border: 2px dashed var(--ln);
  border-radius: var(--pico-border-radius);
}

.exercise .order-line:empty::before {
  align-self: center;
  color: var(--pico-muted-color);
  content: "Нажимайте на слова по порядку";
}

.exercise .order[data-ready] .order-line::after {
  width: 2px;
  height: 1.5em;
  background: var(--blu);
  content: "";
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .exercise .order[data-ready] .order-line::after {
    animation: none;
  }
}

.exercise .order-note {
  margin-bottom: 12px;
  color: var(--mut);
  font-size: 0.875rem;
}

.exercise .order:not([data-ready]) .order-note {
  display: none;
}

.exercise .chip {
  width: auto;
  min-height: 44px; /* the tap target of a phone */
  margin: 0;
  padding: 0.25rem 0.875rem;
  border-color: var(--ln);
  background: var(--pico-card-background-color);
  color: inherit; /* a Pico button sets its own text colour for the primary fill */
  font-size: 1.125rem;
}

/* Pico rings a button in :focus; a tapped or clicked chip keeps no ring, the keyboard
   still shows it (#796). */
.exercise .chip:focus:not(:focus-visible) {
  --pico-box-shadow: none;
}

.exercise .order-line .chip {
  border-color: var(--blu);
  background: var(--blus);
  color: var(--blu);
}

.exercise .order-bank .chip[data-used] {
  border-style: dashed;
  border-color: var(--fnt);
  background: transparent;
  color: var(--fnt);
}

.exercise .order:not([data-ready]) .chip {
  pointer-events: none;
}

/* Free chips (v23, #796, app.js). A chip is lifted by a drag: the press neither selects
   the word nor opens the callout of a long press, and a swipe on it still scrolls. The
   lifted chip floats above the page with a shadow, a little larger; the gap where it
   would land is a dashed blue outline of its size; the neighbours slide aside. A tap
   on a gap of the line puts the insertion point there, a blinking bar in place of the
   caret after the last chip; it takes no room, its margins eat the bar and one gap. */
.exercise .order[data-ready] .chip {
  -webkit-touch-callout: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.exercise .order[data-ready] .order-line .chip,
.exercise .order[data-ready] .order-bank .chip:not([data-used]) {
  cursor: grab;
}

.exercise .order-line .chip {
  transition: transform 150ms ease;
}

.exercise .order-line .chip[hidden] {
  display: none;
}

.exercise .order-line [data-order-gap] {
  border-style: dashed;
  border-color: var(--blu);
  background: transparent;
  color: transparent;
}

.exercise .order [data-order-ghost] {
  position: fixed;
  z-index: 21; /* above the pinned buttons (20), under the header (25) */
  border-color: var(--blu);
  background: var(--blus);
  color: var(--blu);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--hd) 30%, transparent);
  transform: scale(1.05);
  pointer-events: none;
}

.exercise .order[data-dragging],
.exercise .order[data-dragging] .chip {
  cursor: grabbing;
}

.exercise .order[data-ready] .order-line[data-caret]::after {
  display: none;
}

.exercise .order-caret {
  flex: none;
  width: 2px;
  height: 1.5em;
  margin-inline: -6px;
  background: var(--blu);
  animation: caret-blink 1s steps(1) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .exercise .order-line .chip {
    transition: none;
  }

  .exercise .order-caret {
    animation: none;
  }
}

/* A dictation (section 8, v19): the page has the field for text and the bank of
   chips. On a phone (pointer: coarse) the bank answers once app.js has set it up and
   the field is hidden; elsewhere, and without the script, the field answers and the
   bank, its instruction and «Сбросить» are hidden. */
.exercise:not([data-dictation-ready]) .dictation-chips-only {
  display: none;
}

/* A laptop: the field answers, unless the setting dictation_desktop chips (v21, #719)
   gives the card the class dictation-chips-desktop: then the bank answers as on a
   phone and the field is hidden. */
@media not all and (pointer: coarse) {
  .exercise:not(.dictation-chips-desktop) .dictation-chips-only {
    display: none;
  }

  .exercise.dictation-chips-desktop[data-dictation-ready] .dictation-text-only {
    display: none;
  }
}

/* A phone: the bank answers, unless the setting dictation_phone text (v19) gives the
   card the class dictation-typed: then the field for text answers on a phone too and
   the bank stays hidden; app.js leaves a card typed and not chips on a laptop as it
   is. */
@media (pointer: coarse) {
  .exercise[data-dictation-ready]:not(.dictation-typed) .dictation-text-only {
    display: none;
  }

  .exercise.dictation-typed .dictation-chips-only {
    display: none;
  }
}

/* The buttons under the field: «Сбросить» of order on the left, shown by app.js, then
   «Проверить». On a phone they are pinned to the bottom of the screen, above the
   keyboard (--keyboard, app.js); the safe area of the home indicator stays under them
   only without the keyboard (--safe-bottom, app.js, #342). */
.exercise .answer-actions {
  display: flex;
  gap: 8px;
}

.exercise .answer-actions > button {
  margin: 0;
}

.exercise .answer-actions > [hidden] {
  display: none;
}

.exercise .answer-actions [data-order-reset] {
  flex: none;
  width: auto;
  min-height: 52px;
}

.exercise .answer-actions [data-check] {
  flex: 1;
}

/* «Не знаю» without the script (#1258): the outline button under noscript right of
   «Проверить», as wide; with the script the main button reads «Не знаю» itself. Only
   without the script: a display of its own would show the noscript of a page with the
   script as raw text. */
@media (scripting: none) {
  .exercise .answer-actions noscript {
    display: contents;
  }
}

.exercise .answer-actions [data-dont-know-button] {
  flex: 1;
  margin: 0;
}

@media (max-width: 575.98px) {
  .exercise .answer-actions {
    position: fixed;
    right: 0;
    bottom: var(--keyboard, 0px);
    left: 0;
    z-index: 20;
    padding: 8px 16px calc(8px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
    border-top: 1px solid var(--ln);
    background: var(--bg);
  }
}

/* «Проверяю…» in the button while the judge thinks (section 7): it takes the place of
   «Проверить», with a spinner. */
.exercise [data-check] .check-wait {
  color: inherit;
}

.exercise [data-check]:has(.check-wait.htmx-request) .check-idle {
  display: none;
}

.exercise [data-check] .check-wait::before {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.5em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  vertical-align: -0.15em;
  animation: check-spin 0.8s linear infinite;
}

@keyframes check-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Under the card on a laptop: the keys of the screen. */
.key-hints {
  color: var(--mut);
  font-size: 0.875rem;
}

@media (max-width: 575.98px) {
  .key-hints,
  .exercise .checks-left {
    display: none;
  }
}

/* The glossary of translate (section 8, #255): the words with an entry are underlined
   with --blu dots, the open one is filled; a tap or a hover opens a popup under the
   word with the Spanish form and «В слова» (app.js puts it there and keeps it inside
   the screen). Without JS the form is in title. */
.exercise {
  position: relative;
}

.exercise .gloss {
  border-radius: 3px;
  text-decoration: underline dotted var(--blu);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.exercise .gloss[aria-expanded="true"] {
  background: var(--blus);
}

.gloss-pop {
  display: flex;
  position: absolute;
  z-index: 10;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  width: max-content;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
  box-shadow: var(--pico-card-box-shadow);
}

.gloss-pop[hidden] {
  display: none;
}

.gloss-pop .gloss-es {
  font-size: 1.125rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.gloss-pop [data-gloss-saved]:empty {
  display: none;
}

.gloss-pop [data-gloss-saved] {
  color: var(--pico-muted-color);
  font-size: 0.875rem;
}

/* On a phone «Проверить» and «Дальше» are pinned to the bottom of the screen, so the
   end of the page keeps their height clear under it: 8px + 52px + 8px of the bar, its
   1px border and 16px of air, and the safe area of the home indicator. While the
   keyboard is out, app.js adds --answer-room, the height the page lacks to scroll the
   answer field above «Проверить» (#357); without the keyboard it is 0, and the page
   has no scroll to spare. */
@media (max-width: 576px) {
  main:has(.exercise) {
    padding-bottom: calc(85px + env(safe-area-inset-bottom, 0px) + var(--answer-room, 0px));
  }
}

/* «Правило в справочнике» under a result and «Править» under the result of a word
   (#127): a taller tap target, the same look. */
[data-reference-link],
[data-word-edit-link] {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
}

/* A session of words (#127): a long phrase or translation wraps inside a 390px window. */
.word-item .prompt,
.word-item .chip {
  overflow-wrap: anywhere;
}

/* The card of a word (#287): the source small above, the instruction, the word large
   in the middle. */
.word-item .word-source {
  margin-bottom: 4px;
  color: var(--mut);
  font-size: 0.8125rem;
}

/* The link of a lesson: a 44px tap target, 16px of line and 14px above and below; the
   negative margins take the padding back, so the card does not grow; it lies above
   the instruction under it, so a tap there still reaches it. */
.word-item .word-source a {
  display: inline-block;
  position: relative;
  z-index: 1;
  margin-block: -14px;
  padding-block: 14px;
  line-height: 16px;
}

/* The picture of the word (sections 11 and 13.3, v28): 96px on a card recall, 72px
   above the word at typing, before and after the answer; the slot takes its height, so
   the card does not jump between the face, the back and the result. Without a picture
   there is no slot (v30, #1041). The file is transparent: it lies on the card. */
.word-item .word-image-slot {
  height: 96px;
  margin: 8px 0 0;
  line-height: 0;
  text-align: center;
}

.word-item .word-image-slot + .word-prompt {
  margin-top: 4px;
}

.word-item[data-task="type"] .word-image-slot {
  height: 72px;
}

.word-item .word-image-slot .word-image {
  display: inline-block;
  width: auto;
  height: 100%;
  aspect-ratio: 1;
  vertical-align: top;
}

.word-item .word-image-slot .word-image-picture {
  display: inline-block;
  height: 100%;
}

.word-item .word-prompt {
  margin-block: 12px 20px;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}

.word-item .answer-actions [data-check]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* The result of a word: the example on --sf2, then the step of the word and the date
   of its next repeat, with the bar of the page «Слова». */
.word-result .word-note {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
}

.word-result .word-step {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-bottom: 12px;
  color: var(--mut);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* The self-assessment card recall (section 8, v21): «Показать» across the card, then
   the back on --sf2, the Spanish form large in the middle and the example under it,
   and the buttons «Не помню» and «Помню» side by side, 52px. «Показать» is gone once
   the back is open; on the result the back stays open. */
.word-item .recall-card {
  margin-bottom: 12px;
  border: 0;
}

.word-item .recall-card > summary.recall-show {
  display: flex;
  align-items: center;
  justify-content: center;
  list-style: none;
}

.word-item .recall-card > summary.recall-show::-webkit-details-marker {
  display: none;
}

.word-item details.recall-card > summary.recall-show::after {
  display: none;
}

.word-item .recall-card[open] > summary.recall-show {
  display: none;
}

.word-item .recall-back {
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
  text-align: center;
}

.word-item .recall-es {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.word-item .recall-note {
  margin: 8px 0 0;
  color: var(--mut);
  font-size: 0.9375rem;
}

.word-item .recall-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.word-item .recall-actions form {
  margin: 0;
}

.word-item .recall-actions button {
  margin: 0;
}

/* «Уже знаю» and «Не учить» under the card of a word without attempts (v41, #1577):
   two secondary outline buttons side by side, lower and quieter than the 52px answers
   (muted text, regular weight), 44px for a finger on a phone. */
.word-item .recall-new {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  /* Padding, not a margin: «Показать» hangs below its closed card by the negative
     bottom margin of a summary button (Pico), and a margin here would collapse with
     the margin of the card; so the gap is the margin of the card. */
  padding-top: calc(var(--pico-spacing) * 0.75);
}

.word-item .recall-new form {
  margin: 0;
}

.word-item .recall-new button {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 6px 12px;
  color: var(--mut);
  font-size: 0.9375rem;
  font-weight: 400;
}

#answer-alert [role="alert"] {
  color: var(--pico-del-color);
}

/* The result of an answer (section 8, #279). The blank of the card holds the right
   answer, blue, ochre at a mistake in the accent. */
.exercise .prompt .filled {
  color: var(--blu);
  font-weight: 600;
}

.exercise .prompt .filled-accent {
  color: var(--ochi);
}

/* The right phrase once answered (section 8, v26, #926): under a Russian prompt or a
   condition a line of its own; the answer put into it blue and bold, the misspelled
   word of a fix struck out orange before the right one. */
.exercise .prompt .prompt-phrase {
  display: block;
  margin-top: 6px;
}

.exercise .prompt .phrase-right {
  color: var(--blu);
  font-weight: 600;
}

.exercise .prompt .phrase-wrong {
  color: var(--orgi);
  text-decoration: line-through;
  text-decoration-color: var(--org);
}

.exercise .prompt .accent-mark {
  color: var(--ochi);
  font-weight: 700;
}

/* «Где ошибка» (section 7, #926): instead of the answer struck out whole, its wrong
   letters orange and the needed ones of the phrase blue, both bold; the rest of a
   filled blank plain then, so the needed letters stand out. */
.exercise .prompt .filled-diff {
  color: inherit;
  font-weight: inherit;
}

.exercise .diff-right {
  color: var(--blu);
  font-weight: 700;
}

.exercise .diff-wrong {
  color: var(--orgi);
  font-weight: 700;
}

/* The verdict banner of the base region across the card, with «по ключу» on the right
   at a fallback and the reason of a mistake of the judge as its second line (#2085). */
.exercise .result .verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 12px;
  font-size: 1.125rem;
}

.exercise .result .verdict strong {
  color: inherit;
  font-weight: 600;
}

.exercise .result .verdict-by {
  padding: 0 8px;
  border: 1px solid currentColor;
  border-radius: var(--pico-border-radius);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.exercise .result .verdict-reason {
  flex-basis: 100%;
  font-size: 0.9375rem;
  font-weight: 400;
}

.exercise .result .result-caption {
  margin: -4px 0 12px;
  color: var(--mut);
  font-size: 0.875rem;
}

/* The model unavailable: a line on ochre with a sign. */
.exercise .result .result-fallback {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: var(--pico-border-radius);
  background: var(--ochs);
  color: var(--ochi);
  font-size: 0.875rem;
}

.exercise .result .result-fallback::before {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.0625rem;
  border-radius: 50%;
  background: var(--ochi);
  color: var(--ochs);
  content: "!";
  font-weight: 700;
  line-height: 1.25rem;
  text-align: center;
}

/* The rows: «Ваш ответ» struck out at a mistake without «Где ошибка», «Правильно» only
   where the card has no phrase (#926), «Исправление». At a mistake in the accent the
   letter without its mark is underlined in the answer, the letter with it is ochre in
   the right text. */
.exercise .result-rows {
  margin-bottom: 12px;
}

.exercise .result-rows th {
  width: 1%;
  color: var(--mut);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.exercise .result-rows td {
  font-size: 1.0625rem;
  overflow-wrap: anywhere;
}

.exercise .result-rows td.struck {
  color: var(--orgi);
  text-decoration: line-through;
  text-decoration-color: var(--org);
}

.exercise .result-rows .accent-miss {
  text-decoration: underline 2px var(--och);
  text-underline-offset: 0.2em;
}

.exercise .result-rows .accent-mark {
  color: var(--ochi);
  font-weight: 700;
}

/* choose: the options stay; the right one blue, the chosen wrong one orange and struck
   out, the others faint. */
.exercise .result-options {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.exercise .result-options li {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  margin-bottom: 8px;
  padding: 0 15px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  color: var(--fnt);
  list-style: none;
}

.exercise .result-options kbd {
  min-width: 1.75em;
  padding: 0.125em 0.375em;
  border: 1px solid var(--ln);
  background: var(--sf2);
  color: inherit;
  text-align: center;
}

.exercise .result-options .result-option-mark {
  margin-left: auto;
  font-weight: 700;
}

.exercise .result-options li[data-option="right"] {
  padding-inline: 14px;
  border: 2px solid var(--blu);
  background: var(--blus);
  color: var(--blu);
  font-weight: 600;
}

.exercise .result-options li[data-option="chosen"] {
  padding-inline: 14px;
  border: 2px solid var(--orgl);
  background: var(--orgs);
  color: var(--orgi);
}

.exercise .result-options li[data-option="chosen"] [lang] {
  text-decoration: line-through;
  text-decoration-color: var(--org);
}

.exercise .result .result-note {
  margin-bottom: 12px;
}

/* respond, the result (section 8, #1736): «Смысл верный, поправьте форму» in a blue
   outline with «засчитано» on --blus, ochre only at the stress marks; «Вопрос был о
   другом», «Вы повторили фразу» and «Не знаю» orange by the banner of the base region;
   the mark «с текстом вопроса» under the banner. Then the conversation of the card with
   its bubbles open: the Spanish text, the translation in --mut and a 44px button of the
   sound on the right, 90% of the card on a phone and 72% from 576px; the answer a
   bubble «ВЫ» on the right on --sf framed in --blu at a counted answer and in --org at
   one not counted, the wrong letters orange, bold and struck out, the correction blue
   under it, the line why in --mut; «Пример ответа» a dashed --blu bubble. */
.exercise .result-respond .verdict {
  justify-content: flex-start;
}

.exercise .result[data-respond-banner="accent"] .verdict,
.exercise .result[data-respond-banner="form"] .verdict {
  border: 1px solid var(--blu);
  background: transparent;
  color: var(--blu);
}

.exercise .result .verdict-counted {
  padding: 0 8px;
  border-radius: var(--pico-border-radius);
  background: var(--blus);
  color: var(--blu);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.exercise .result .respond-text-mark {
  display: inline-block;
  margin: -4px 0 12px;
  padding: 2px 10px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
  color: var(--mut);
  font-size: 0.8125rem;
}

.talk-result .talk-bubble.talk-open {
  align-items: flex-start;
  width: 90%;
}

.talk-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.talk-text p {
  margin: 0;
  overflow-wrap: anywhere;
}

.talk-result .talk-mark {
  margin-top: 1px;
}

.talk-es {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
}

.talk-ru {
  color: var(--mut);
  font-size: 0.875rem;
  line-height: 1.35;
}

.talk-who {
  color: var(--mut);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.talk .talk-sound {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -8px -8px -8px 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--blu);
  box-shadow: none;
}

.talk .talk-sound:focus-visible {
  outline: 2px solid var(--blu);
  outline-offset: -2px;
}

.talk .talk-sound[data-listen-state="loading"] {
  color: var(--mut);
}

.talk .talk-part[data-playing] .talk-sound {
  background: var(--sf);
}

.talk .talk-you .talk-bubble,
.talk .talk-sample .talk-bubble {
  border-width: 1.5px;
  border-style: solid;
  border-color: var(--blu);
  background: var(--sf);
}

.talk .talk-you[data-you="wrong"] .talk-bubble {
  border-color: var(--org);
}

.talk .talk-sample .talk-bubble {
  border-width: 1px;
  border-style: dashed;
}

.talk-you .diff-wrong,
.talk-you .struck {
  color: var(--orgi);
  text-decoration: line-through;
  text-decoration-color: var(--org);
}

.talk-you .accent-miss {
  text-decoration: underline 2px var(--och);
  text-underline-offset: 0.2em;
}

.talk-you .talk-fixed {
  color: var(--blu);
}

.talk-why {
  color: var(--mut);
  font-size: 0.875rem;
}

@media (min-width: 576px) {
  .talk-result .talk-bubble.talk-open {
    width: 72%;
  }
}

/* A respond the judge gave no verdict on (sections 7 and 8, #1665, #1666): the line on
   ochre and «Дальше» in the slot of the form, whose field and «Проверить» go. */
.exercise .answer-form:has([data-skipped]) > :is(label, .voice-row, .voice-status, .answer-actions) {
  display: none;
}

#answer-alert .respond-skipped {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: var(--pico-border-radius);
  background: var(--ochs);
  color: var(--ochi);
}

/* The slips under the rows (#377): «Опечатка: the word of the learner orange and struck
   out → the right one blue» and «В слова», a 44px tap target, which turns into «в
   словах». On a narrow screen the button wraps under the words, the rows stay whole. */
.exercise .result-slips {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.exercise .result-slips li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  min-height: 44px;
  margin-bottom: 4px;
  list-style: none;
}

.exercise .result-slips .slip-text {
  min-width: 0;
  color: var(--mut);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.exercise .result-slips .slip-wrong {
  color: var(--orgi);
  text-decoration: line-through;
  text-decoration-color: var(--org);
}

.exercise .result-slips .slip-right {
  color: var(--blu);
  font-weight: 600;
}

.exercise .result-slips form {
  margin: 0;
}

.exercise .result-slips button {
  min-height: 44px;
  margin: 0;
}

.exercise .result-slips .slip-saved {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--mut);
  font-size: 0.875rem;
}

/* The six forms of a cell of the topic verbs under the explanation (section 5.5, #927):
   two columns, the singular on the left and the plural on the right; the asked form on
   --blus in blue, the irregular ones bold, the pronouns muted. Open at a mistake,
   folded into «Все формы» at a right answer. */
.exercise .result-verb-table {
  margin: 0 0 12px;
}

.exercise .result-verb-table > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  color: var(--blu);
  font-size: 0.9375rem;
  font-weight: 500;
}

.exercise .result-verb-table[open] > summary {
  margin-bottom: 4px;
}

.exercise .result-verb-table table {
  width: 100%;
  margin: 0;
  table-layout: fixed;
  border-collapse: collapse;
}

.exercise .result-verb-table td {
  padding: 8px 10px;
  border: 1px solid var(--ln2);
  background: var(--sf);
  color: var(--ink);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.exercise .result-verb-table td.verb-table-asked {
  background: var(--blus);
  color: var(--blu);
}

.exercise .result-verb-table .verb-table-pronoun {
  margin-right: 6px;
  color: var(--mut);
  font-size: 0.875rem;
}

.exercise .result-verb-table td.verb-table-asked .verb-table-pronoun {
  color: var(--blu);
}

.exercise .result-verb-table strong {
  font-weight: 700;
}

/* The new words of a dictation under the explanation (section 5.3, #927): «todavía ·
   ещё» and «В слова», a 44px tap target, which turns into «в словах»; laid out as the
   slips. */
.exercise .result-new-words {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.exercise .result-new-words li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  min-height: 44px;
  margin-bottom: 4px;
  list-style: none;
}

.exercise .result-new-words .new-word-text {
  min-width: 0;
  color: var(--mut);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.exercise .result-new-words .new-word-es {
  color: var(--ink);
  font-weight: 600;
}

.exercise .result-new-words form {
  margin: 0;
}

.exercise .result-new-words button {
  min-height: 44px;
  margin: 0;
}

.exercise .result-new-words .slip-saved {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--mut);
  font-size: 0.875rem;
}

/* The answer of a drill cell that is a form of another tense (section 5.5, v32). */
.exercise .result-tense-note {
  margin: 0 0 12px;
  color: var(--ink);
}

/* The target words of an exercise of the words mode under the rows (section 8, v17):
   «слово: la mesa ✓» blue, «слово: la mesa, не употреблено» orange, the words carry the
   meaning as well as the colour (rule 1 of section 2.1); at a fallback one muted line. */
.exercise .result-words {
  margin: 0 0 12px;
  padding: 0;
  font-size: 0.9375rem;
  list-style: none;
}

.exercise .result-words li {
  margin-bottom: 4px;
  list-style: none;
  overflow-wrap: anywhere;
}

.exercise .result-words .result-word-used {
  color: var(--blu);
}

.exercise .result-words .result-word-missed {
  color: var(--orgi);
}

.exercise .result-words .result-word-unchecked {
  color: var(--mut);
}

/* The picture of a target word (v28), 32px at the start of its line after the answer. */
.exercise .result-words .word-image {
  width: 32px;
  height: 32px;
  margin-right: 6px;
  vertical-align: middle;
}

/* «Правило в справочнике», «Спросить» and «Не согласен», «Дальше». On a phone the two
   foldouts share one frame and «Дальше» is pinned to the bottom of the screen; on a
   laptop they are secondary buttons in a row with the link, «Дальше» on the right, and
   an open one unfolds under the row. */
.exercise .result-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.exercise .result-tools details {
  margin: 0;
}

.exercise .result-more {
  align-self: stretch;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
}

.exercise .result-more summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
}

.exercise .result-more details[open] > summary {
  margin-bottom: 0;
}

.exercise .result-more details > form,
.exercise .result-more details > [data-ask-reply] {
  padding: 0 12px;
}

.exercise .result-more details > [data-ask-reply]:not(:empty) {
  padding-bottom: 12px;
}

.exercise .result-more .flag {
  border-top: 1px solid var(--ln2);
}

.exercise .result-more .flag > [data-flag-saved] {
  margin: 0;
  padding: 8px 12px 0;
  color: var(--mut);
  font-size: 0.875rem;
}

.exercise .result-more button {
  width: auto;
}

/* «проверила модель» at a verdict of the judge (#2085): a quiet line next to «Не
   согласен», under the frame on a phone, in the row on a laptop. */
.exercise .result-checked-by {
  margin: 0;
  color: var(--mut);
  font-size: 0.8125rem;
}

.exercise .result-next {
  margin: 0;
}

.exercise .result-next [data-next] {
  margin: 0;
}

@media (max-width: 575.98px) {
  .exercise .result-next {
    position: fixed;
    right: 0;
    bottom: var(--keyboard, 0px);
    left: 0;
    z-index: 20;
    padding: 8px 16px calc(8px + var(--safe-bottom, env(safe-area-inset-bottom, 0px)));
    border-top: 1px solid var(--ln);
    background: var(--bg);
  }
}

@media (min-width: 576px) {
  .exercise .result-tools {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .exercise .result-more,
  .exercise .result-more > .flag {
    display: contents;
  }

  .exercise .result-more summary {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--ln);
    border-radius: var(--pico-border-radius);
    background: var(--sf2);
    font-size: 0.875rem;
  }

  /* Where ::details-content is unknown, an open foldout goes under the row whole,
     its button on top, in the frame of the phone. */
  .exercise .result-more details[open] {
    flex-basis: 100%;
    order: 2;
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--ln);
    border-radius: var(--pico-border-radius);
  }

  .exercise .result-more details[open] > summary {
    width: max-content;
    margin-bottom: 12px;
  }

  .exercise .result-more details > form,
  .exercise .result-more details > [data-ask-reply] {
    padding: 0;
  }

  .exercise .result-more .flag > [data-flag-saved] {
    flex-basis: 100%;
    order: 4;
    margin-top: 8px;
    padding: 0;
  }

  /* Elsewhere the buttons stay in the row and only the content of an open foldout
     goes under it, in the frame of the phone; both open share one frame. */
  @supports selector(::details-content) {
    .exercise .result-more details,
    .exercise .result-more details[open] {
      display: contents;
    }

    .exercise .result-more details[open] > summary {
      width: auto;
      margin-bottom: 0;
    }

    .exercise .result-more details::details-content {
      flex-basis: 100%;
      order: 2;
      margin-top: 12px;
      padding: 12px;
      border: 1px solid var(--ln);
      border-radius: var(--pico-border-radius);
    }

    .exercise .result-more .flag details::details-content {
      order: 3;
    }

    .exercise .result-more details:not([open])::details-content {
      display: none;
    }

    .exercise .result-more:has(.flag details[open]) .ask[open]::details-content {
      border-bottom: 0;
      border-bottom-right-radius: 0;
      border-bottom-left-radius: 0;
    }

    .exercise .result-more:has(.ask[open]) .flag details[open]::details-content {
      margin-top: 0;
      border-top-color: var(--ln2);
      border-top-left-radius: 0;
      border-top-right-radius: 0;
    }
  }

  .exercise .result-next {
    order: 1;
    margin-left: auto;
  }

  .exercise .result-next [data-next] {
    width: auto;
    padding-inline: 40px;
  }
}

/* The answer of the model under «Спросить» keeps its line breaks, on --sf2;
   «Спрашиваю…» shows only while htmx waits for it. */
.ask-wait:not(.htmx-request) {
  display: none;
}

.ask-wait {
  color: var(--pico-muted-color);
}

.ask-answer {
  padding: 8px 12px;
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
  white-space: pre-wrap;
}

.ask-error {
  color: var(--pico-del-color);
}

.flag button {
  width: auto;
}

.flag-error {
  color: var(--pico-del-color);
}

.flag-error:empty {
  display: none;
}

/* «Не согласен» on a word (v38, #1409): the reasons as a row of radio buttons in the
   frame of the foldout of a result; on the back of a card recall the frame stands under
   «Не помню» and «Помню». */
.flag-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}

.flag-reasons legend {
  margin-bottom: 4px;
  color: var(--mut);
  font-size: 0.875rem;
}

.flag-reasons label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0;
}

.flag-reasons input {
  margin: 0;
}

.exercise .recall-flag {
  margin-top: 16px;
}

.flag [data-flag-saved] {
  color: var(--mut);
  font-size: 0.875rem;
}

/* «Проверяю…» under the answer form of a fuzzy kind while the judge thinks (section 7). */
.check-wait:not(.htmx-request) {
  display: none;
}

.check-wait {
  color: var(--pico-muted-color);
}

/* The summary of a session (section 8, #285). In the header: the score large and on a
   row of their own the segments of every answer, coloured as in the header of the
   session. */
.summary-score {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.summary-score-caption {
  color: var(--hdm);
}

.summary-score-value {
  color: var(--hdi);
  font-size: 40px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

.summary-score-of {
  color: var(--hdm);
  font-weight: 500;
}

.summary-score .tag {
  align-self: center;
}

.summary-segments {
  display: flex;
  flex-basis: 100%;
  gap: 4px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.summary-segments > .segment {
  flex: 1;
  height: 6px;
  margin: 0;
  border-radius: 2px;
  background: var(--hdl);
  list-style: none;
}

.summary-segments:has(> :nth-child(20)) {
  gap: 2px;
}

.summary-segments:has(> :nth-child(20)) > .segment {
  height: 4px;
}

.summary-segments > .segment[data-state="ok"] {
  background: var(--seg-ok);
}

.summary-segments > .segment[data-state="bad"] {
  background: var(--seg-bad);
}

.summary-segments > .segment[data-state="now"] {
  background: var(--seg-now);
}

/* The mixed drill of the topic verbs (section 8, v32): the score of each tense on a
   row of its own under the segments, on the dark band. */
.summary-by-subtopic {
  flex-basis: 100%;
  margin: 4px 0 0;
  color: var(--hdm);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* The body: the facts and the error queue, then the mistakes; side by side on a
   laptop. */
.summary {
  display: grid;
  gap: 0 24px;
  margin-bottom: var(--pico-spacing);
}

@media (min-width: 900px) {
  .summary:has(> .summary-mistakes) {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }
}

.summary-facts,
.summary-mistakes {
  min-width: 0;
}

/* Without mistakes the facts do not stretch over the whole laptop width. */
.summary:not(:has(> .summary-mistakes)) > .summary-facts {
  max-width: 640px;
}

.summary h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
}

.summary-table th {
  width: 40%;
  color: var(--mut);
  font-weight: 500;
}

.summary-table td {
  font-variant-numeric: tabular-nums;
}

/* «Вернутся 19 октября»: the date is not broken over lines in a narrow column. */
.summary-table time {
  white-space: nowrap;
}

.summary-note {
  color: var(--mut);
}

.summary-status > p:last-child {
  margin-bottom: 0;
}

/* The words of «Слова и грамматика» (v17): «· повторить 28 окт» wraps as a whole under
   the bar of the word, the separator does not stay alone at the end of the line. */
.summary-word-due {
  white-space: nowrap;
}

/* The block «Повторение» (#375; before v42 «Расписание»): a check not passed is the
   whole line «проверка не пройдена: …» in orange, the words carry the meaning (rule 1
   of section 2.1); «Как работает повторение» under the table. */
.summary-schedule-failed {
  color: var(--orgi);
  font-weight: 600;
}

.summary-schedule .repetition-help {
  margin-top: 12px;
}

/* A mistake: the phrase with the right answer blue, under it the answer given struck
   out in orange. */
.summary-mistake-list {
  margin: 0 0 var(--pico-spacing);
  padding: 0;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
  list-style: none;
}

.summary-mistake-list > li {
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ln2);
  list-style: none;
  overflow-wrap: anywhere;
}

.summary-mistake-list > li:last-child {
  border-bottom: 0;
}

.summary-mistake-list p {
  margin: 0;
}

.summary-phrase {
  font-weight: 500;
}

.summary-right {
  color: var(--blu);
  font-weight: 600;
}

.summary-gone {
  color: var(--fnt);
  font-weight: 400;
}

.summary-yours {
  color: var(--mut);
  font-size: 0.875rem;
}

.summary-yours s {
  color: var(--orgi);
  text-decoration-color: var(--org);
}

/* A mistake of a respond in the summary (section 8, #1736): the sign and «Диалог · 2
   реплики» in --mut over the question, the 44px button of the sound after them; without
   JS the players of the browser under the line. */
.summary-respond {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 6px;
  color: var(--mut);
  font-size: 0.8125rem;
}

.summary-respond .talk-summary {
  margin: 0;
}

.talk-summary .talk-parts {
  margin: 0;
}

.talk-summary[data-respond-ready] .talk-parts {
  display: none;
}

.summary-respond .talk-summary:not([data-respond-ready]) {
  flex: 1 1 100%;
}

.talk-summary .talk-sound {
  margin: 0;
}

/* The buttons, 52px each (section 8, v41): the main one over the whole row, «Дальше:
   …» in ochre (docs/ios.md 7.10), else «На «Сегодня»» or «Продолжить» dark; under it in
   a row «На «Сегодня»» and «Ещё раз» outlined, «Ещё раз» in soft ochre after an abort.
   On a laptop the row is two columns of 240px. */
.summary-done {
  margin-bottom: calc(var(--pico-spacing) * 0.75);
  color: var(--mut);
}

.summary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--pico-spacing);
}

/* The main button over the whole row, and so a button alone in the row under it:
   «Ещё раз» under «На «Сегодня»», «На «Сегодня»» under «Дальше» without «Ещё раз». */
.summary-actions > .summary-main,
.summary-actions > :nth-child(2):last-child {
  grid-column: 1 / -1;
}

.summary-actions > form {
  margin: 0;
}

.summary-actions :is(button, [role="button"]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin: 0;
}

.summary-actions :is(.summary-main, .summary-main > button) {
  font-size: 1.0625rem;
  font-weight: 600;
}

/* As specific as Pico's hover rule, and later, so the tones hold in every state. */
.summary-actions :is(button, [role="button"]).summary-next {
  --pico-background-color: var(--och);
  --pico-border-color: var(--och);
  --pico-color: var(--hd);
}

.summary-actions :is(button, [role="button"]).summary-soft {
  --pico-background-color: var(--ochs);
  --pico-border-color: var(--ochs);
  --pico-color: var(--ochi);
}

@media (min-width: 576px) {
  .summary-actions {
    grid-template-columns: repeat(2, 240px);
    justify-content: start;
  }
}

@media (max-width: 575.98px) {
  .summary-score-value {
    font-size: 32px;
  }
}

/* panel «Эта сессия» (#284): to the right of the card from 900px on, the card and its
   key hints keep the left column. Three numbers (right blue, mistakes orange, left),
   the mistakes «правильно ← ваш ответ» with the answer struck out in orange, the line
   about the retries. Below 900px the panel is hidden and the screen stays as it is. */
.session-panel {
  display: none;
}

@media (min-width: 900px) {
  .session-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    align-items: start;
  }

  .session-panel {
    display: block;
    padding: 16px;
    border: 1px solid var(--ln);
    border-radius: var(--pico-border-radius);
    background: var(--sf);
  }
}

.session-panel .session-panel-title {
  margin: 0 0 12px;
  color: var(--mut);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.session-panel .session-panel-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 16px;
}

.session-panel .session-panel-numbers > div {
  display: flex;
  flex-direction: column-reverse;
}

.session-panel .session-panel-numbers dt {
  margin: 0;
  color: var(--mut);
  font-size: 13px;
  font-weight: 400;
}

.session-panel .session-panel-numbers dd {
  margin: 0;
  color: var(--ink);
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.session-panel .panel-count-right dd {
  color: var(--blu);
}

.session-panel .panel-count-wrong dd {
  color: var(--org);
}

.session-panel .table-frame {
  margin-bottom: 8px;
}

.session-panel table {
  margin: 0;
  font-size: 14px;
}

.session-panel :is(th, td) {
  padding: 6px 10px;
}

.session-panel td:first-child {
  width: 1%;
  color: var(--mut);
  white-space: nowrap;
}

.session-panel .panel-right {
  color: var(--blu);
  font-weight: 600;
}

.session-panel .panel-hidden {
  color: var(--mut);
}

.session-panel .panel-answer {
  color: var(--orgi);
  text-decoration: line-through var(--org);
}

/* «Не знаю» (v26): no answer to strike out, the words say it. */
.session-panel .panel-dont-know {
  color: var(--mut);
}

.session-panel .session-panel-caption {
  margin: 0;
  color: var(--mut);
  font-size: 13px;
}

/* === today === */

/* «Повторить сегодня» (v12, #388): one list of rows of one form, the active sessions,
   «Работа над ошибками», the lesson, «Слова», «Слова и грамматика», «Своя сессия», the
   topics, each in a tbody with the warning about its pool; no rows of subtopics since
   v25, no summary of the debt in the header since #1645. On a phone the table turns
   into a list. */

/* One list (v12, #388): a table without a head, Что | Почему и сколько | Уровень |
   действие, with fixed columns, so the folded part under «Ещё» lines up with the shown
   one and a laptop never scrolls it. Every button stands in the common column on the
   right, of one width; the main ones 44px, «Настроить» of «Своя сессия» the secondary
   40px. */
.today-frame {
  margin-bottom: 32px;
}

.today-table {
  width: 100%;
  table-layout: fixed;
}

.today-table .col-why {
  width: 33%;
}

.today-table .col-level {
  width: 11%;
}

.today-table .col-act {
  width: 264px;
}

.today-table :is(th, td) {
  padding: 10px 12px;
  vertical-align: middle;
}

/* A block or a topic with the warning about its pool is a group: a line under it. */
.today-table tbody > tr:last-child > td {
  border-bottom: 1px solid var(--ln);
}

.today-table tbody:last-child > tr:last-child > td {
  border-bottom: 0;
}

/* The title of a row: 16px 600; a link where it leads somewhere (the digest, «Слова»,
   the reference of a topic). */
.today-table .row-title {
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

/* A title that is a link is a tap target of 40px at least, the secondary size of
   section 2.1 (#1646): an inline box, its glyphs of about 20px padded by 10px above
   and below. The padding of an inline box takes taps and moves nothing: a long title
   wraps as text, the tag after it stays on its line, the row keeps its height.
   Positioned, it stays above the plain text of the line under it, which its padding
   overlaps; the link of a weak subtopic under it, stacked under 768px, see below. */
.today-table a.row-title {
  position: relative;
  padding-block: 10px;
}

/* Underlined under a mouse only: on a touch screen a tap leaves :hover stuck, and the
   title of the tapped row stayed underlined on a phone (#1479). */
@media (hover: hover) {
  .today-table a.row-title:hover {
    text-decoration: underline;
  }
}

/* «Почему и сколько»: 13px --mut, the tag of the reason first. */
.today-row > .c-why {
  color: var(--mut);
  font-size: 13px;
}

.today-row > .c-why .tag {
  margin-inline-end: 4px;
}

/* A topic (v25): the reason and the summary in one phrase, «[к повторению] 3 подтемы,
   +4 дн.» or «[слабая] Глаголы на -ar, 52 %» with the weakest subtopic as a link to its
   section of the reference, a tap target of 44px around the line without making the row
   taller; the pool «новых 18 / всего 61» on a line under it. */
.today-reason,
.today-topic .today-pool {
  display: block;
}

.today-topic .today-pool {
  margin-top: 2px;
}

.today-reason a {
  display: inline-block;
  margin-block: -14px;
  padding-block: 14px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ln);
  text-underline-offset: 2px;
}

.today-reason a:hover {
  text-decoration-color: currentColor;
}

/* A number with its word never breaks: «отвечено 1 из 10», «к повторению 0», «новых 8»,
   «32 упражнения»; the line wraps only between the pairs, at «·». */
.today-pool,
.today-row > .c-why :is(.today-pair, [data-progress], [data-lesson-count], [data-exercises], [data-topics]) {
  white-space: nowrap;
}

.today-table .flag-mark {
  color: var(--ochi);
  white-space: nowrap;
}

.today-row code {
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* The column of buttons: one button of one width on the right, «Продолжить» and
   «Прервать» side by side filling it. */
.today-table .c-act {
  text-align: right;
}

.today-table .c-act .practice {
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin: 0;
}

.today-table .c-act :is(button, [role="button"]) {
  min-width: 116px;
  padding-inline: 12px;
}

.today-row > .c-act :is(button, [role="button"]) {
  min-height: 44px;
  padding-block: 0.5rem;
}

/* «Продолжить» is a link: its text centred like that of the buttons next to it. */
.today-table .c-act [role="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.today-table .c-act .lesson-refused {
  margin: 0;
  color: var(--mut);
  font-size: 13px;
  text-align: left;
}

/* The warning about the pool: a row of its own on --ochs with the skill command. */
.today-table .today-warn > td {
  padding-block: 8px;
  background-color: var(--ochs);
  color: var(--ochi);
  font-size: 0.875rem;
}

.today-warn code {
  overflow-wrap: anywhere;
}

/* «Ещё N тем»: the last row of the list, opening the folded recommendations. */
.today-more {
  margin: 0;
}

.today-more > summary,
.today-more[open] > summary {
  margin: 0;
  padding: 12px;
  border-top: 1px solid var(--ln);
  background: var(--sf2);
  font-weight: 500;
  line-height: 1rem;
}

.today-more[open] > summary {
  border-bottom: 1px solid var(--ln);
}

/* Between a phone and a laptop (#1318, half the screen of a Mac at about 800 px) the
   table fits its frame, which never scrolls: the column of why shrinks to a quarter and
   the bar of the level takes the small segments of the phone in a column of 92px, the
   column of buttons keeps its 264px. 1280 px and wider keep the columns above. */
@media (min-width: 768px) and (max-width: 1279.98px) {
  .today-table .col-why {
    width: 25%;
  }

  .today-table .col-level {
    width: 92px;
  }

  .today-row .level-bar > i {
    width: 0.625rem;
    height: 0.375rem;
  }
}

/* Narrower than 768 px four columns do not fit beside the buttons: a row is the title
   with the line of why under it and the bar under that, the buttons on the right in the
   same column of 264px. Rows of one block are apart by --ln2, blocks by --ln. */
@media (min-width: 576px) and (max-width: 767.98px) {
  .today-table,
  .today-table tbody,
  .today-table tr,
  .today-table td {
    display: block;
  }

  .today-table colgroup {
    display: none;
  }

  .today-table td,
  .today-table tbody > tr:last-child > td {
    border-bottom: 0;
  }

  .today-table tr + tr {
    border-top: 1px solid var(--ln2);
  }

  .today-table tbody {
    border-bottom: 1px solid var(--ln);
  }

  .today-table tbody:last-child {
    border-bottom: 0;
  }

  .today-table .today-row {
    display: grid;
    grid-template-areas:
      "name act"
      "why act"
      "level act";
    grid-template-columns: minmax(0, 1fr) 264px;
    gap: 2px 0;
    align-items: center;
    padding-block: 10px;
  }

  .today-table .today-row > td {
    padding: 0 12px;
  }

  .today-table .today-row > .c-name {
    grid-area: name;
  }

  .today-table .today-row > .c-why {
    grid-area: why;
  }

  .today-table .today-row > .c-level {
    grid-area: level;
    padding-top: 4px;
  }

  .today-table .today-row > .c-level:empty {
    display: none;
  }

  .today-table .today-row > .c-act {
    grid-area: act;
  }
}

/* A phone: the table is a list. A row is its title with the line of why under it and
   the button on the right; a topic has its phrase of the reason under the title and,
   a third line, a small bar with the pool next to it; two buttons, a long one or a
   message go in a row of their own under the line. */
@media (max-width: 575.98px) {
  .today-table,
  .today-table tbody,
  .today-table tr,
  .today-table td {
    display: block;
  }

  .today-table colgroup {
    display: none;
  }

  .today-table td,
  .today-table tbody > tr:last-child > td {
    padding: 0;
    border-bottom: 0;
  }

  .today-table tbody {
    border-bottom: 1px solid var(--ln);
  }

  .today-table .today-rec {
    padding-bottom: 8px;
  }

  .today-table tbody:last-child {
    border-bottom: 0;
  }

  .today-table .today-row {
    display: grid;
    grid-template-areas:
      "name act"
      "why act"
      "level act";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    align-items: center;
    padding: 12px;
  }

  .today-table .today-rec > .today-row {
    padding-bottom: 4px;
  }

  .today-table .today-row > .c-name {
    grid-area: name;
  }

  .today-table .today-row > .c-why {
    grid-area: why;
  }

  .today-table .today-row > .c-level {
    grid-area: level;
  }

  .today-table .today-row > .c-level:empty {
    display: none;
  }

  .today-table .today-row > .c-act {
    grid-area: act;
  }

  .today-table .c-act :is(button, [role="button"]) {
    min-width: 96px;
  }

  .today-table .today-row:is(.is-running, .is-wide) {
    grid-template-areas:
      "name"
      "why"
      "level"
      "act";
    grid-template-columns: minmax(0, 1fr);
  }

  .today-table .today-row:is(.is-running, .is-wide) > .c-act {
    padding-top: 4px;
    text-align: left;
  }

  .today-table .today-row:is(.is-running, .is-wide) .practice {
    justify-content: flex-start;
  }

  .today-row .level-bar > i {
    width: 0.625rem;
    height: 0.375rem;
  }

  /* The topic (v25): the cell of why gives its phrase and its pool to the grid, the
     pool goes on the third line after the bar. */
  .today-table .today-topic {
    grid-template-areas:
      "name name act"
      "why why act"
      "level pool act";
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .today-table .today-topic > .c-why {
    display: contents;
  }

  .today-topic .today-reason {
    grid-area: why;
  }

  .today-topic .today-pool {
    grid-area: pool;
    margin-top: 0;
  }

  .today-table .today-topic:is(.is-running, .is-wide) {
    grid-template-areas:
      "name name"
      "why why"
      "level pool"
      "act act";
    grid-template-columns: auto minmax(0, 1fr);
  }

  .today-table .today-warn {
    margin: 4px 12px 0;
  }

  .today-table .today-warn > td {
    padding: 6px 10px;
    border-radius: var(--pico-border-radius);
    font-size: 0.8125rem;
  }
}

/* Stacked under 768px, a weak topic has the link of its weakest subtopic right under
   the title, 2-4px apart: two targets of 40px share that space (#1646). The title takes
   the padding of the row above its line and the gap under it, the link its own line
   and the line of the bar and the pool under it, above them, so neither covers the
   other. */
@media (max-width: 767.98px) {
  .today-table .today-topic a.row-title {
    padding-block: 16px 5px;
  }

  .today-topic .today-reason a {
    position: relative;
    margin-block: 0 calc(1lh - 40px);
    padding-block: 0 calc(40px - 1lh);
  }
}

/* «Своя сессия» (v19, section 10; a row of the list since v25): a cell over the four
   columns holding a <details>; its summary is a row of the form of the others, a grid
   of the same columns as the table (Что | Почему и сколько | Уровень | действие), with
   «Настроить» as the secondary button of 40px and without the chevron of Pico. Open,
   the form under the row: the topics and the kinds as checkboxes with their counts in
   --mut, three columns on a laptop, one under another on a phone; the number,
   «Начать» with a refusal above it. */
.today-table .today-custom-row > td {
  padding: 0;
}

.today-custom,
.today-custom[open] {
  margin: 0;
}

.today-custom > summary.today-custom-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 33% 11% 264px;
  align-items: center;
  margin: 0;
  padding: 0;
  line-height: inherit;
}

.today-custom > summary.today-custom-summary::after {
  display: none;
}

.today-custom-summary > span {
  padding: 10px 12px;
}

.today-custom-why {
  grid-column: 2;
  color: var(--mut);
  font-size: 13px;
}

.today-custom-act {
  grid-column: 4;
  text-align: right;
}

/* «Настроить»: drawn as the secondary outline button of 40px, as «Прервать» next to it
   in the column; the summary is what is pressed, so the label is no button of its own. */
.today-custom-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  min-height: 40px;
  padding: 0 12px;
  border: var(--pico-border-width) solid var(--ln);
  border-radius: var(--pico-border-radius);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
}

.today-custom-summary:hover .today-custom-open,
.today-custom[open] .today-custom-open {
  border-color: var(--mut);
}

.today-custom-summary:focus-visible {
  outline: 2px solid var(--btn);
  outline-offset: -2px;
}

.today-custom[open] > .today-custom-summary {
  border-bottom: 1px solid var(--ln);
}

.today-custom-form {
  margin: 0;
  padding: 16px 12px;
}

.today-custom-form :is(.custom-topics, .custom-kinds) {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 16px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

.today-custom-form legend {
  margin-bottom: 4px;
  padding: 0;
  font-weight: 500;
}

.today-custom-form legend small,
.custom-size small {
  margin-left: 4px;
  color: var(--mut);
  font-size: 0.8125rem;
  font-weight: 400;
}

.today-custom-form fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0;
}

.today-custom-form fieldset input[type="checkbox"] {
  flex: none;
  margin: 0;
}

.custom-count {
  color: var(--mut);
  font-variant-numeric: tabular-nums;
}

.custom-none {
  margin: 0;
  color: var(--mut);
}

.custom-size label {
  font-weight: 500;
}

.custom-size input[type="number"] {
  max-width: 8rem;
  margin-bottom: 12px;
}

.custom-act {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.custom-act [data-custom-start] {
  width: auto;
  min-width: 160px;
  margin: 0;
}

/* A refusal where «Начать» stands: on --orgs, as .form-error, with the command. */
.custom-refused {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: var(--pico-border-radius);
  background: var(--orgs);
  color: var(--orgi);
}

.custom-refused p {
  margin: 0;
}

.custom-refused code {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* An unfinished own session over other topics or kinds (v25): on --ochs, as the tag
   «начато» of its row, with «Продолжить» and «Прервать и начать новую». */
.custom-refused.is-active {
  background: var(--ochs);
  color: var(--ochi);
}

.custom-active-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.custom-active-actions > :is(a, button) {
  width: auto;
  margin: 0;
}

@media (max-width: 991.98px) {
  .today-custom-form :is(.custom-topics, .custom-kinds) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Between a phone and a laptop (#1318) the summary follows the columns of the table:
   the quarter of why and the 92px of the level from 768 px, the line of why under the
   title narrower. */
@media (min-width: 768px) and (max-width: 1279.98px) {
  .today-custom > summary.today-custom-summary {
    grid-template-columns: minmax(0, 1fr) 25% 92px 264px;
  }
}

@media (min-width: 576px) and (max-width: 767.98px) {
  .today-custom > summary.today-custom-summary {
    grid-template-areas:
      "name act"
      "why act";
    grid-template-columns: minmax(0, 1fr) 264px;
    gap: 2px 0;
    padding-block: 10px;
  }

  .today-custom-summary > span {
    padding: 0 12px;
  }

  .today-custom-name {
    grid-area: name;
  }

  .today-custom-why {
    grid-area: why;
  }

  .today-custom-act {
    grid-area: act;
  }
}

@media (max-width: 575.98px) {
  .today-custom-form :is(.custom-topics, .custom-kinds) {
    grid-template-columns: minmax(0, 1fr);
  }

  .today-custom > summary.today-custom-summary {
    grid-template-areas:
      "name act"
      "why act";
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 12px;
  }

  .today-custom-summary > span {
    padding: 0;
  }

  .today-custom-name {
    grid-area: name;
  }

  .today-custom-why {
    grid-area: why;
  }

  .today-custom-act {
    grid-area: act;
  }

  .today-custom-open {
    min-width: 96px;
  }

  .custom-act,
  .custom-act [data-custom-start],
  .custom-refused.is-active,
  .custom-active-actions,
  .custom-active-actions > :is(a, button) {
    width: 100%;
  }
}

/* «Спряжение» (v35, #1297, section 10): a row of the form of «Своя сессия», since #1343
   with its summary as is: one secondary «Настроить» on the right, beside the line of
   the tenses on a phone too. Open, the form of the choice of tenses under the row
   (since #1325 only here): the tenses as checkboxes of 44px in --ink, the filter of
   verbs «Все · Правильные · Неправильные» as the segmented control of the theme of the
   settings (v36, #1351), «Клеток» as «Упражнений» of «Своя сессия», «Начать» under
   them. */
.today-conjugation-form {
  padding: 16px 12px;
}

.drill-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
}

.drill-choice-boxes {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 4px 16px;
}

.drill-choice-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.drill-choice-box input[type="checkbox"] {
  margin: 0;
}

/* The tenses and, next to them, the grid «время × лицо» (v46, #1708, section 10): side
   by side on the Mac, the grid under the tenses on a phone. In a cell the share of right
   attempts over PERSONS_DAYS days, coloured as the result of the block «глаголы группы»:
   «трудно» orange, «неплохо» grey, «легко» blue; an empty cell dashed. */
.drill-choice-tenses {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 32px;
  max-width: 100%;
}

.drill-persons-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.drill-persons-caption {
  margin: 0 0 2px;
  color: var(--mut);
  font-size: 0.75rem;
}

/* A column of the tenses, then six columns of the persons, each at least 2.5rem. */
.drill-persons {
  display: grid;
  grid-template-columns: max-content repeat(6, minmax(2.5rem, auto));
  gap: 3px;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.drill-persons-row {
  display: contents;
}

.drill-persons [role="columnheader"] {
  color: var(--mut);
  text-align: center;
}

.drill-persons-tense {
  padding-right: 8px;
  color: var(--ink);
  white-space: nowrap;
}

.drill-person {
  padding: 1px 4px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
  font-weight: 600;
  text-align: center;
}

.drill-person[data-status="hard"] {
  color: var(--org);
}

.drill-person[data-status="ok"] {
  color: var(--mut);
}

.drill-person[data-status="easy"] {
  color: var(--blu);
}

.drill-person[data-status="new"] {
  border-style: dashed;
  background: transparent;
}

/* «Справочник: presente › indefinido ›» under «Начать»: links to the entry topics. */
.drill-choice .drill-references {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin: 0;
  font-size: 0.875rem;
}

/* Inline-block, not flex: a flex link would drop the spaces of «Справочник: presente ›». */
.drill-choice .drill-references a {
  display: inline-block;
  padding-block: 12px;
  line-height: 20px;
}

/* .segmented of the settings, as wide as the form on a phone, up to 26rem on the Mac. */
.drill-choice .drill-choice-verbs {
  align-self: stretch;
  max-width: 26rem;
  margin: 0;
}

/* «Неправильные» in bold is wider than a third of 390px: the segments grow from their
   words, the free width shared equally. */
.drill-choice .drill-choice-verbs > label {
  flex: 1 1 auto;
}

/* A row of the groups of the irregular verbs of one tense (v37, #1368): the label of
   the tense on the left, the checkboxes after it, wrapping on a phone. */
.drill-choice .drill-choice-groups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 16px;
  margin: 0;
  padding: 0;
  border: 0;
}

.drill-choice .drill-choice-groups[hidden] {
  display: none;
}

.drill-choice .drill-choice-groups-tense {
  float: left;
  margin: 0;
  padding: 0;
  color: var(--mut);
  font-size: 0.875rem;
}

/* A checkbox of a group in two lines (#1395): its name, under it the examples of forms
   in italics, «tuve, hizo, dijo». */
.drill-choice-group-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.drill-choice-group-examples {
  color: var(--mut);
  font-size: 0.8125rem;
  font-style: italic;
}

.drill-choice-size label {
  font-weight: 500;
}

.drill-choice-size small {
  margin-left: 4px;
  color: var(--mut);
  font-size: 0.8125rem;
  font-weight: 400;
}

.drill-choice-size input[type="number"] {
  max-width: 8rem;
  margin-bottom: 4px;
}

.drill-choice [data-drill-start] {
  width: auto;
  min-width: 160px;
  margin: 0;
}

@media (max-width: 575.98px) {
  .drill-choice {
    align-items: stretch;
  }

  .drill-choice [data-drill-start] {
    width: 100%;
  }
}

/* The levels on «Сегодня» (v40, #1479; sketches 106 А, 108 А and 110): the card
   «Открыт уровень A2» above the table with «Начать», «Не сейчас» and the cross; the row
   of the new subtopic has its tag next to the title. */
.level-card {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-bottom: 16px;
  padding: 16px 56px 16px 20px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--blus);
  color: var(--ink);
}

.level-card-text {
  flex: 1 1 24rem;
  min-width: 0;
}

.level-card-title {
  margin: 0 0 4px;
  font-size: 1.0625rem;
  font-weight: 600;
}

.level-card-text p {
  margin: 0;
  font-size: 0.9375rem;
}

.level-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.level-card-actions :is(button, [role="button"]) {
  min-height: 44px;
  margin: 0;
}

.level-card-close {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
}

.level-card-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mut);
}

.level-card-x:hover,
.level-card-x:focus-visible {
  background: transparent;
  color: var(--ink);
}

/* «С какого уровня начать» of the first run (docs/multiuser.md 10.9, #1930; #2036,
   sketch 183 Ур2 «Три плитки»): a white card with an ochre line on top, without the
   cross; under the text three equal tiles A1, A2, B1, each a button of the form: the
   level large, its hint, «Начать с A1» under them. No tile stands out at rest; the
   hover and the focus give the tile a blue frame and fill, the focus its ring too. In a
   row from 576px, rows one under another on a phone. */
.level-choice {
  padding: 18px 20px 20px;
  border-top: 3px solid var(--och);
  background: var(--sf);
}

.level-choice-form {
  display: grid;
  flex: 1 1 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.level-choice-form .level-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  outline: none;
  background-color: var(--sf);
  box-shadow: none;
  color: var(--ink);
  font-weight: 400;
  text-align: start;
}

.level-choice-form .level-tile:is(:hover, :focus-visible) {
  border-color: var(--blu);
  background-color: var(--blus);
  color: var(--ink);
}

.level-choice-form .level-tile:focus-visible {
  box-shadow: 0 0 0 3px var(--fcs);
}

.level-tile-name {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
}

.level-tile-hint {
  font-size: 0.9375rem;
  font-weight: 500;
}

.level-tile-action {
  margin-top: 8px;
  color: var(--blu);
  font-size: 0.875rem;
  font-weight: 500;
}

.today-new-subtopic > .c-name .tag {
  margin-inline-start: 6px;
  vertical-align: 2px;
}

@media (max-width: 575.98px) {
  .level-card {
    padding: 14px 48px 14px 14px;
  }

  .level-card-actions {
    flex: 1 1 100%;
  }

  .level-choice {
    padding: 14px;
  }

  .level-choice-form {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .level-choice-form .level-tile {
    flex-direction: row;
    align-items: baseline;
    gap: 12px;
    min-height: 56px;
    padding: 12px 14px;
  }

  .level-tile-name {
    flex: 0 0 2.5rem;
    font-size: 1.375rem;
  }

  .level-tile-hint {
    flex: 1 1 auto;
    min-width: 0;
  }

  .level-tile-action {
    margin-top: 0;
    white-space: nowrap;
  }
}

/* «План на сегодня» (section 10, v42, #1594; sketch 117): a card over the whole width
   under the card of a level, its steps in two columns from 768px and in one on a
   phone, the one main button of the screen under them in ochre (the summary's «Дальше»,
   docs/ios.md 7.10); the rows of «Ещё можно» under it keep secondary buttons. A step:
   its number in a circle, blue at the current step, a check at a step done; the title,
   the line «что и сколько» under it, on the right «≈ 6 мин» or the state in a word. A
   plan done is two lines, a day without steps one. */
.plan-card {
  margin-bottom: 24px;
  padding: 20px 24px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
  color: var(--ink);
}

.plan-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 600;
}

.plan-break {
  margin: 0 0 8px;
  color: var(--mut);
  font-size: 0.9375rem;
}

.plan-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: 32px;
  margin: 0 0 16px;
  padding: 0;
}

.plan-step {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding-block: 12px;
  border-bottom: 1px solid var(--ln2);
  list-style: none;
}

.plan-num {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--ln);
  border-radius: 50%;
  color: var(--mut);
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.plan-step.is-current .plan-num {
  border-color: var(--blu);
  background: var(--blu);
  color: var(--sf);
}

.plan-step.is-done .plan-num,
.plan-done-line .plan-num {
  border-color: var(--blus);
  background: var(--blus);
  color: var(--blu);
}

.plan-step-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.plan-step-title {
  font-weight: 600;
}

.plan-step-caption {
  color: var(--mut);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.plan-step-state {
  flex: none;
  color: var(--mut);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plan-step.is-done .plan-step-state {
  color: var(--blu);
}

.plan-step:is(.is-running, .is-begun) .plan-step-state {
  color: var(--ochi);
}

.plan-start {
  margin: 0;
}

/* As specific as Pico's hover rule of a submit button, so the ochre holds in every state. */
.plan-start :is(button, [type="submit"]).plan-button {
  --pico-background-color: var(--och);
  --pico-border-color: var(--och);
  --pico-color: var(--hd);
  width: auto;
  min-width: 240px;
  min-height: 52px;
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
}

.plan-done-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 600;
}

.plan-done-steps {
  margin: 4px 0 0 38px;
  color: var(--mut);
  font-size: 0.875rem;
}

.plan-card.is-empty .plan-done-line {
  color: var(--mut);
  font-weight: 500;
}

/* «Ещё можно» over the rows. */
.today-more-title {
  margin: 0 0 8px;
  color: var(--mut);
  font-size: 0.9375rem;
  font-weight: 600;
}

@media (min-width: 768px) {
  .plan-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .plan-card {
    padding: 16px;
  }

  .plan-start :is(button, [type="submit"]).plan-button {
    width: 100%;
    min-width: 0;
  }
}

/* === topics === */

/* The filters in the header of the page: links with a count, the active one filled
   white. The header is dark in both themes, so are their colours. */
.topic-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start; /* Pico spreads a nav */
  gap: 6px;
}

.topic-filters a {
  display: inline-block;
  padding: 0 12px;
  line-height: 34px;
  border: 1px solid var(--hdl);
  border-radius: var(--pico-border-radius);
  color: var(--hdm);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}

.topic-filters a:hover {
  color: var(--hdi);
}

.topic-filters a[aria-current] {
  border-color: var(--hdi);
  background: var(--hdi);
  color: var(--hd);
  font-weight: 600;
}

/* The table: Тема и подтемы | Уровень | Расписание | action, without the course classes
   (#378). A laptop of 1280px fits it without scrolling. */
.topics-table {
  width: 100%;
  table-layout: fixed; /* the line of links of a topic without attempts spans all columns */
}

.topics-table :is(th, td) {
  padding: 8px 12px;
  vertical-align: middle;
}

.topics-table thead th {
  font-size: 0.8125rem;
}

.topics-table thead th:nth-child(2) {
  width: 19%;
}

.topics-table thead th:nth-child(3) {
  width: 24%;
}

/* The action fits «Практика»; «Продолжить» and «Прервать» stack. The title takes the
   rest. */
.topics-table thead th:nth-child(4) {
  width: 148px;
}

.topics-table td small {
  font-size: 0.8125rem;
}

.topics-table [data-weak] {
  white-space: nowrap;
}

/* The row of a topic on --sf2: the title as a link. */
.table-frame .topics-table .topic-row > td {
  background-color: var(--sf2);
  border-top: 1px solid var(--ln);
}

.topics-table thead + tbody .topic-row > td {
  border-top: 0;
}

.topic-row h2 {
  display: inline;
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.topic-row h2 a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--ink);
  text-decoration: none;
}

.topic-row h2 a:hover {
  color: var(--blu);
  text-decoration: underline;
}

.topic-schedule,
.subtopic-schedule {
  color: var(--mut);
  font-size: 0.875rem;
}

.topic-schedule .due-today,
.subtopic-schedule .due-today {
  color: var(--org);
  font-weight: 500;
}

.topic-action,
.subtopic-action {
  text-align: right;
  white-space: nowrap;
}

.topics-table .practice {
  justify-content: flex-end;
  margin: 0;
}

/* The fold of the subtopics is for a phone only. */
.subtopics-fold {
  display: none;
}

/* The rows of subtopics: indented under their topic. */
.topics-table .subtopic-name {
  padding-left: 28px;
}

.subtopic-name > a {
  display: inline-flex;
  align-items: center;
  min-height: 40px; /* a comfortable tap target on a phone */
}

.topics-table .mastery {
  flex-wrap: nowrap;
}

/* A topic without attempts: its subtopics in one line of links divided by «·». */
.topics-table .subtopic-line-row > td {
  padding-left: 28px;
}

.subtopic-line {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}

.subtopic-line li {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin: 0;
  list-style: none;
}

/* The dot before every item but the first: an item that wraps to the next line takes
   its dot along, so the line is pulled left by the dot and its gap and clipped there;
   the first item keeps their place empty (#1479: no dot at the start of a line). */
.subtopic-line {
  margin-inline-start: -1.6em;
  clip-path: inset(0 0 0 1.6em);
}

.subtopic-line li:first-child {
  padding-inline-start: 1.6em;
}

.subtopic-line li + li::before {
  content: "·";
  flex: none;
  width: 1.25em;
  color: var(--fnt);
  text-align: center;
}

.subtopic-line a {
  display: inline-flex;
  align-items: center;
  min-height: 40px; /* a comfortable tap target on a phone */
}

/* A phone: a list. The topic is its title, the line of the status, the bar
   with «N слабая» and the button; the subtopics a nested list with a line on the left.
   The cells flow as flex items, the cell of the title gives its children to the row. */
@media (max-width: 575.98px) {
  .topic-filters {
    gap: 4px;
  }

  .topic-filters a {
    padding: 0 7px;
    font-size: 0.8125rem;
    line-height: 42px; /* 44px with the border: a tap target on a phone */
  }

  .topics-frame {
    border: 0;
    background: transparent;
  }

  .topics-table,
  .topics-table tbody,
  .topics-table tr,
  .topics-table td {
    display: block;
  }

  .topics-table thead {
    display: none;
  }

  .topics-table tbody {
    margin-bottom: 12px;
    border: 1px solid var(--ln);
    border-radius: var(--pico-border-radius);
    background: var(--sf);
    overflow: hidden;
  }

  .table-frame .topics-table :is(td, th) {
    padding: 0;
    border: 0;
    background-color: transparent;
  }

  .topics-table .topic-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 0;
    padding: 8px 12px 12px;
    background: var(--sf2);
  }

  .table-frame .topics-table .topic-row > td {
    border-top: 0;
    background-color: transparent;
  }

  .topics-table .topic-name {
    display: contents;
  }

  .topic-row h2 {
    display: block;
    flex: 1 0 100%;
    order: 0;
  }

  /* The status on a line of its own under the title (no level label since v40). */
  .topics-table .topic-schedule {
    flex: 1 1 100%;
    order: 3;
  }

  .topics-table .topic-level {
    flex: 1 0 100%;
    order: 4;
    padding-block: 4px;
  }

  .topics-table .topic-action {
    flex: 1 0 100%;
    order: 5;
    text-align: left;
  }

  .topics-table .topic-action .practice {
    justify-content: flex-start;
  }

  .topics-table .topic-action :is(button, [role="button"]) {
    min-height: 44px;
  }

  .subtopics-fold {
    display: block;
    flex: 1 0 100%;
    order: 6;
    margin: 4px 0 -8px;
  }

  .subtopics-fold > summary {
    display: flex;
    align-items: center;
    min-height: 44px; /* a tap target on a phone */
    margin: 0;
    padding-block: 0;
    color: var(--blu);
    font-size: 0.875rem;
  }

  /* A folded topic hides its subtopics until «N подтем» opens. */
  .topics-table tbody:has(.subtopics-fold:not([open])) .subtopic-row {
    display: none;
  }

  .topics-table .subtopic-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 8px;
    margin: 0 12px 0 20px;
    padding: 4px 0 4px 12px;
    border-left: 2px solid var(--ln);
  }

  .topics-table .topic-row + .subtopic-row {
    margin-top: 8px;
  }

  .topics-table .subtopic-row:last-child {
    margin-bottom: 12px;
  }

  .topics-table .subtopic-name {
    flex: 1 1 0;
    order: 0;
    min-width: 0;
  }

  .topics-table .subtopic-action {
    order: 1;
  }

  /* The title and «Практика» on the first line, the bar and the schedule under them. */
  .topics-table .subtopic-row::after {
    content: "";
    flex: 1 0 100%;
    order: 2;
  }

  .topics-table .subtopic-level {
    order: 3;
  }

  .topics-table .subtopic-schedule {
    order: 4;
  }

  .table-frame .topics-table .subtopic-line-row > td {
    margin: 8px 12px 12px 20px;
    padding-left: 12px;
    border-left: 2px solid var(--ln);
  }

  /* Long titles do not share a line on a phone: the subtopics of a topic without
     attempts go in a column, one link of 44px per row, without the dots. */
  .topics-table .subtopic-line {
    display: block;
    margin-inline-start: 0;
    clip-path: none;
  }

  .topics-table .subtopic-line li:first-child {
    padding-inline-start: 0;
  }

  .topics-table .subtopic-line li {
    display: flex;
    flex-wrap: wrap;
  }

  .topics-table .subtopic-line li + li::before {
    content: none;
  }

  .topics-table .subtopic-line a {
    min-height: 44px;
  }
}

/* The levels on the map (v40, #1479; sketches 104 А and 110): the line of the open
   level over the table, a heading row per block of the map, a topic without an open
   subtopic muted, a closed subtopic with the lock and its level. */
.topics-level {
  margin: 0 0 12px;
  color: var(--mut);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* «Как работает повторение» right under the line of the level (v42, #1591). */
.topics-level + .repetition-help {
  margin: 0 0 16px;
}

.table-frame .topics-table .topic-block-row > th {
  padding-block: 14px 8px;
  border-top: 1px solid var(--ln);
  background-color: var(--sf);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
}

.topics-table thead + .topic-block .topic-block-row > th {
  border-top: 0;
}

.topic-block-count {
  margin-left: 6px;
  color: var(--mut);
  font-weight: 400;
}

.topics-table .level-done {
  color: var(--blu);
  font-weight: 600;
}

.topics-table .due-today .level-done {
  color: inherit;
}

.topic.is-later .topic-row h2 a,
.topic.is-later .topic-schedule {
  color: var(--fnt);
}

.subtopic-closed {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--fnt);
  text-decoration: none;
}

.subtopic-closed:hover {
  color: var(--mut);
  text-decoration: underline;
}

@media (max-width: 575.98px) {
  /* The heading of a block stands over its cards, not in one. */
  .topics-table tbody.topic-block {
    margin: 20px 0 8px;
    border: 0;
    background: transparent;
  }

  .topics-table tbody.topic-block:first-of-type {
    margin-top: 0;
  }

  .table-frame .topics-table .topic-block-row > th {
    display: block;
    padding: 0 2px;
    border: 0;
    background-color: transparent;
  }

  .topics-table .subtopic-closed {
    min-height: 44px;
  }

  .topics-table .subtopic-row.is-closed .subtopic-name {
    flex: 1 1 100%;
  }
}

/* === reference === */

/* The page of a topic (v9, #283). The header: «Темы / A1» (no course classes, #378) above
   the title, the status of the schedule under it (written before the h1, put after it
   here), on the right «Практика» or «Продолжить · 4 из 10» in ochre with «Прервать». */
body > header div:has(> .topic-head-status) {
  display: flex;
  flex-direction: column;
}

.topic-head-status {
  order: 1;
  margin: 6px 0 0;
  color: var(--hdm);
  font-size: 0.875rem;
}

/* «повторить сегодня» on the dark band: the orange of the header. */
.topic-head-status .due-today {
  color: var(--seg-bad);
}

.topic-head-side .practice {
  margin: 0;
}

/* The main button of the header is light on the dark band in both themes. */
.topic-head-side [data-practice] {
  --pico-background-color: var(--hdi);
  --pico-border-color: var(--hdi);
  --pico-color: var(--hd);
}

.topic-head-side [role="button"].continue-och {
  --pico-background-color: var(--och);
  --pico-border-color: var(--och);
  --pico-color: var(--hd);
  font-variant-numeric: tabular-nums;
}

.topic-head-side .practice button.outline.secondary[data-abort] {
  --pico-background-color: transparent;
  --pico-border-color: var(--hdm);
  --pico-color: var(--hdi);
}

/* «Своя сессия» under «Практика» (section 8, v17): a light link on the dark band that
   opens a card of the page colours with the form. From 576px the card drops over the
   page under the link, so the header keeps its height; on a phone it takes the width
   of the header in the flow. */
.topic-head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

/* Why kinds or a number sent over the topic were refused («Ещё раз» of an own session
   of v17); the form «Своя сессия» is on «Сегодня» since v19. */
.own-session-error {
  max-width: 22rem;
  margin: 0;
}

@media (max-width: 575.98px) {
  .topic-head-side {
    align-items: stretch;
    width: 100%;
  }
}

/* Two columns on a laptop: the text in a card up to about 720px and the side column
   with «На этой странице» and «Разбор ошибок»; on a phone and a tablet one column,
   the side column first with its boxes folded. */
.reference-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pico-spacing);
  align-items: start;
  margin-block: var(--pico-spacing);
}

@media (min-width: 992px) {
  .reference-layout {
    grid-template-columns: minmax(0, 46rem) minmax(15rem, 1fr);
    gap: 2rem;
  }

  .reference-side {
    grid-column: 2;
    grid-row: 1;
  }

  .reference-card {
    grid-column: 1;
    grid-row: 1;
  }
}

/* The text of the reference: 16px with a line height of 1.6 (rule 4 of section 2.1). */
.reference-card {
  margin: 0;
  padding: 24px 28px;
  font-size: 16px;
  line-height: 1.6;
}

@media (max-width: 575.98px) {
  .reference-card {
    padding: 16px;
  }
}

.reference > :last-child,
.reference > .ref-section:last-child > :last-child {
  margin-bottom: 0;
}

/* The boxes of the side column: a card with a title row. A <details> folded on a phone;
   on a laptop always unfolded, its summary a plain title. */
.ref-box {
  margin: 0 0 var(--pico-spacing);
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
}

.ref-box:last-child {
  margin-bottom: 0;
}

.ref-box > summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  margin: 0;
  padding: 10px 40px 10px 16px;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.3;
}

.ref-box > summary::after {
  position: absolute;
  right: 16px;
}

details.ref-box[open] > summary {
  margin-bottom: 0;
  border-bottom: 1px solid var(--ln2);
}

.ref-box-body {
  padding: 12px 16px 16px;
}

.ref-box-body > :last-child {
  margin-bottom: 0;
}

@media (min-width: 992px) {
  .ref-box::details-content {
    content-visibility: visible;
  }

  .ref-box > summary {
    padding-right: 16px;
    border-bottom: 1px solid var(--ln2);
    cursor: default;
    pointer-events: none;
  }

  .ref-box > summary::after {
    display: none;
  }
}

/* «На этой странице»: the subtopics with the small bars of their level, as on the map,
   then «Типичные ошибки» and «Связанные темы». */
.ref-toc-list {
  margin: 0;
  padding: 0;
}

.ref-toc-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 8px;
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px solid var(--ln2);
  list-style: none;
  font-size: 0.9375rem;
}

.ref-toc-list li:last-child {
  border-bottom: 0;
}

.ref-toc-list a {
  min-width: 0;
  text-decoration: none;
}

.ref-toc-list .ref-toc-extra a {
  color: var(--mut);
}

.ref-toc-list .level-bar {
  gap: 1px;
}

.ref-toc-list .level-bar > i {
  width: 0.5rem;
  height: 0.375rem;
}

/* On a phone a row of the contents is a tap target of at least 44px (rule 4 of
   section 2.1, #345): the link takes the whole height of the row and the width left
   of the bar, the row loses its padding instead. The laptop keeps the dense list. */
@media (max-width: 575.98px) {
  .ref-toc-list li {
    min-height: 44px;
    padding-block: 0;
  }

  .ref-toc-list a {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    align-self: stretch;
    min-height: 44px;
  }
}

/* «Разбор ошибок»: the date on the right of the title, the text, «Разобрать» or how
   many new mistakes there are of the ten it needs. */
.review-day {
  color: var(--mut);
  font-size: 0.8125rem;
  font-weight: 400;
  white-space: nowrap;
}

.review-new,
.review-none {
  color: var(--mut);
  font-size: 0.875rem;
}

.review-text {
  white-space: pre-line;
  font-size: 0.9375rem;
}

.review-error {
  color: var(--orgi);
}

.review form {
  margin-bottom: 0;
}

.review-wait:not(.htmx-request) {
  display: none;
}

.review-wait {
  margin: calc(0.5 * var(--pico-typography-spacing-vertical)) 0 0;
  color: var(--mut);
}

/* Section headings: a 2px --ink line under them. A subtopic heading carries its classes
   and «Практика» of 40px on the right, under it on a phone. A link /topics/<id>#slug
   lands on the heading with some air above it and highlights it; the header does not
   stick, so it never covers the heading. */
.reference h2 {
  margin: 0 0 var(--pico-typography-spacing-vertical);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ink);
  font-size: 1.375rem;
  line-height: 1.3;
}

.ref-section {
  margin-top: calc(var(--pico-spacing) * 2);
}

/* Air above a heading jumped to, under the sticky row of the sections; the row and the
   safe area above it are kept clear by scroll-padding-top (header region, #328). */
.reference h2[id],
.ref-section[id] {
  scroll-margin-top: 24px;
}

.reference h2:target,
.ref-section:target > h2,
.subtopic-head:has(> h2:target) {
  background-color: var(--pico-mark-background-color);
  color: var(--pico-mark-color);
}

.subtopic-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 16px;
  margin-bottom: var(--pico-typography-spacing-vertical);
  border-bottom: 2px solid var(--ink);
}

.subtopic-head > h2 {
  flex: 1 1 16rem;
  margin: 0;
  border-bottom: 0;
}

.subtopic-head-side {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 6px;
}

@media (max-width: 575.98px) {
  .subtopic-head {
    display: block;
    border-bottom: 0;
  }

  .subtopic-head > h2 {
    margin-bottom: 8px;
    border-bottom: 2px solid var(--ink);
  }

  .subtopic-head-side {
    justify-content: space-between;
    padding-bottom: 0;
  }
}

/* Tables of forms in a frame: the head on --sf2, the first column (pronoun or label)
   grey, the endings marked in markdown with **...** blue. A table wider than the
   screen scrolls sideways inside its frame, not the page: as a block it is its own
   scroll container, as wide as its content up to the column width. */
.reference table {
  display: block;
  width: max-content;
  min-width: min(100%, 24rem);
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
}

.reference :is(th, td) {
  background-color: var(--sf);
  border-bottom: 1px solid var(--ln2);
}

.reference thead th {
  background-color: var(--sf2);
  font-weight: 600;
}

.reference tbody tr:last-child > :is(th, td) {
  border-bottom: 0;
}

.reference td:first-child,
.reference th:first-child {
  color: var(--mut);
  white-space: nowrap;
}

/* A first column of phrases wraps (#1339): a table whose first column holds an example,
   a link or code (*...*, [...], `...`) is a table of rules, not of forms. Its phrases
   wrap but on a laptop not narrower than 14em, so a short label or a list of pronouns
   of 174px («ellos, ellas, ustedes») stays on one line. A table of forms, whose first
   column is plain pronouns or labels, keeps them on one line and scrolls on a phone. */
.reference table:has(td:first-child :is(em, a, code)) :is(td, th):first-child {
  min-width: 14em;
  white-space: normal;
}

/* On a phone the threshold is 8em: 14em made a short first column wider than on one
   line (168-203px) and the table scrolled further; at 8em none of them is wider than
   on one line, and none scrolls further. */
@media (max-width: 575.98px) {
  .reference table:has(td:first-child :is(em, a, code)) :is(td, th):first-child {
    min-width: 8em;
  }
}

/* On a phone narrower cells, so a table of three columns fits without scrolling. */
@media (max-width: 576px) {
  .reference td,
  .reference th {
    padding-inline: 0.5rem;
  }
}

.reference td strong,
.reference th strong {
  color: var(--blu);
}

/* «Типичная ошибка» (rule 6): the frame of --orgl and the title on --orgs in --orgi,
   without a bar on the left, are the admonition of the base region. */

/* The levels on the page of a topic (v40, #1479; sketches 105 А and 110): «4 открытые
   подтемы» under «Практика» on the dark band, «Дальше: N подтем» last in «На этой
   странице», the block «Дальше» folded at the bottom of the card with the rows of the
   closed subtopics, the confirmation of «Открыть сейчас» unfolded in place, the note
   and the sections of the closed subtopics. */
.topic-head-side .practice-caption {
  color: var(--hdm);
  font-size: 0.8125rem;
}

.ref-toc-list .ref-toc-next a {
  display: inline-flex;
  align-items: center;
  color: var(--mut);
}

.level-tag {
  display: inline-flex;
  align-items: center;
  padding: 0 0.4rem;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
  color: var(--mut);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.5;
}

.ref-next {
  margin-top: calc(var(--pico-spacing) * 2);
  border-top: 2px solid var(--ink);
}

.ref-next > summary.ref-next-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-height: 48px;
  margin: 0;
  padding-block: 8px;
  color: var(--ink);
}

.ref-next-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.ref-next-count {
  margin-left: auto;
  color: var(--mut);
  font-size: 0.9375rem;
}

.ref-next-list {
  margin: 0;
  padding: 0;
}

.ref-next-row {
  position: relative; /* the hidden checkbox stays in the row */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--ln2);
  list-style: none;
  color: var(--mut);
}

.ref-next-name {
  display: inline-flex;
  flex: 1 1 18rem;
  align-items: baseline;
  min-width: 0;
  font-size: 0.9375rem;
}

.ref-next-name strong {
  color: var(--ink);
  font-weight: 600;
}

.ref-next-name small {
  color: var(--mut);
  font-size: 0.8125rem;
}

/* «Открыть сейчас»: the label of a hidden checkbox; checked, the confirmation unfolds
   on a line of its own under the row, which keeps its layout. */
.ref-next-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
}

label.ref-next-open {
  display: inline-flex;
  flex: none;
  align-items: center;
  width: auto;
  min-height: 40px;
  margin: 0;
  padding: 0 14px;
  font-size: 0.875rem;
  cursor: pointer;
}

.ref-next-toggle:focus-visible + .ref-next-open {
  box-shadow: 0 0 0 3px var(--fcs);
}

.ref-next-confirm {
  display: none;
  flex: 1 1 100%;
  margin-top: 2px;
  padding: 12px 14px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
  color: var(--ink);
  font-size: 0.9375rem;
}

.ref-next-toggle:checked ~ .ref-next-confirm {
  display: block;
}

.ref-next-confirm p {
  margin-bottom: 0.5rem;
}

.ref-next-question {
  font-weight: 600;
}

.ref-next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.ref-next-actions :is(button, [role="button"]) {
  width: auto;
  min-height: 44px;
  margin: 0;
}

.ref-next-note {
  margin: 10px 0 0;
  color: var(--mut);
  font-size: 0.875rem;
}

.ref-section-closed > h2 {
  color: var(--mut);
}

/* The name of a closed subtopic in its row leads to its section below (#1540): the
   ink of the name, underlined so it reads as a link. */
.ref-next-name a.ref-next-read {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--mut);
  text-underline-offset: 3px;
}

.ref-next-name a.ref-next-read:hover {
  text-decoration-color: currentColor;
}

/* Under the heading of a closed section: its level, «в практику темы пока не входит»
   and «Открыть сейчас» with the confirmation of the rows above (#1540). */
.ref-closed-bar {
  position: relative; /* the hidden checkbox stays in the bar */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 0 var(--pico-spacing);
  padding: 8px 0;
  border-bottom: 1px solid var(--ln2);
}

.ref-closed-level {
  color: var(--mut);
  font-size: 0.875rem;
}

@media (max-width: 575.98px) {
  label.ref-next-open {
    min-height: 44px;
  }

  /* A tap target of 44px on a phone without moving the row. */
  .ref-next-name a.ref-next-read {
    padding-block: 10px;
    margin-block: -10px;
  }
}

/* The block «глаголы группы» of the reference of a tense (section 5.5, v46, #1706;
   sketches 134–138): the table «глагол · yo · él, ella · у вас в дрилле», the rows over
   VERB_GROUP_VISIBLE in a second table under «Ещё N глаголов» with the same columns, the
   marked part of a form blue as the endings of the tables of forms, the result as a word
   in its colour (hard --org, ok grey, easy --blu, new faint) with «· 3 из 7» small,
   «Тренировать эту группу · N глаголов» in soft ochre after it and the short link at
   the heading of the section. */
.reference .verb-group {
  margin-bottom: var(--pico-typography-spacing-vertical);
}

.reference .verb-group .overflow-auto {
  margin-bottom: 0;
}

.reference table.verb-group-table {
  display: table;
  width: 100%;
  min-width: 20rem;
  max-width: none;
  table-layout: fixed;
  margin-bottom: 0;
}

.verb-group-table .verb-group-col-verb {
  width: 34%;
}

.verb-group-table .verb-group-col-form {
  width: 21%;
}

.verb-group-table .verb-group-col-status {
  width: 24%;
}

/* A form never breaks inside a word; a reflexive one may break after its pronoun. */
.reference .verb-group-table td[lang="es"] {
  overflow-wrap: normal;
}

/* The verb and its translation wrap by words only. */
.reference .verb-group-table td:first-child {
  color: var(--ink);
  white-space: normal;
  overflow-wrap: normal;
}

.verb-group-table .verb-group-ru {
  display: block;
  color: var(--mut);
  font-size: 0.8125rem;
  line-height: 1.35;
}

.verb-group-table .verb-group-status {
  font-size: 0.875rem;
  line-height: 1.35;
}

.verb-group-table .verb-group-status small {
  color: var(--mut);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.verb-group-table .verb-status {
  font-weight: 600;
}

.verb-group-table .verb-status[data-status="hard"] {
  color: var(--org);
}

.verb-group-table .verb-status[data-status="ok"] {
  color: var(--mut);
}

.verb-group-table .verb-status[data-status="easy"] {
  color: var(--blu);
}

.verb-group-table .verb-status[data-status="new"] {
  color: var(--fnt);
  font-weight: 500;
}

.reference .verb-group-more {
  margin: 0.5rem 0 0;
}

/* Away from the table above it, open or closed --blu in both themes: the selector
   outweighs Pico's colours of an open and a focused summary. */
.reference .verb-group > details.verb-group-more > summary:not([role]) {
  margin-block: 0;
  padding-block: 0.5rem;
  color: var(--blu);
  font-size: 0.875rem;
  font-weight: 500;
}

.reference .verb-group > details.verb-group-more[open] > summary:not([role]) {
  margin-bottom: 0.25rem;
}

.reference .verb-group-actions {
  margin: 0.75rem 0 0;
}

.reference .verb-group-actions [role="button"].verb-group-train {
  --pico-background-color: var(--ochs);
  --pico-border-color: var(--ochs);
  --pico-color: var(--ochi);
  min-height: 40px;
  font-size: 0.9375rem;
}

/* The tap target is 40px high: the padding grows it, the negative margins keep the
   heading as it was. */
.reference .verb-group-link {
  display: inline-block;
  margin-left: 0.75rem;
  padding-block: 12px;
  margin-block: -12px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
}

/* On a phone narrower padding and a smaller type: at 390px the longest words of the
   table («despertarse», «развлекаться», «consiguió») fit their columns whole. */
@media (max-width: 575.98px) {
  .verb-group-table .verb-group-col-verb {
    width: 30%;
  }

  .verb-group-table .verb-group-col-form {
    width: 24%;
  }

  .verb-group-table .verb-group-col-status {
    width: 22%;
  }

  .reference .verb-group-table :is(td, th) {
    padding-inline: 0.375rem;
  }

  .reference .verb-group-table :is(td[lang="es"], td:first-child) {
    font-size: 0.9375rem;
  }

  .reference .verb-group-actions [role="button"].verb-group-train {
    width: 100%;
    min-height: 44px;
  }

  .reference .verb-group > details.verb-group-more > summary:not([role]) {
    min-height: 44px;
  }
}

/* === words === */

/* Page «Слова» (section 11, v9 #280). The header of the page: four counters and
   «Повторить · N» in ochre. The header is dark in both themes, so are its colours. */
.words-aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.words-summary {
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
}

.words-summary li {
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--hdm);
  font-size: 0.8125rem;
  list-style: none;
}

.words-summary strong {
  color: var(--hdi);
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

/* «N к повторению · M новых сегодня» (v41, #1577): what a session by the schedule
   takes today, beside the counters; M is what is left of the daily norm. */
.words-today {
  margin: 0;
  color: var(--hdm);
  font-size: 0.875rem;
}

.words-today strong {
  color: var(--hdi);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.words-aside .practice {
  margin: 0;
}

.words-aside .practice [data-progress] {
  color: var(--hdm);
  font-size: 0.875rem;
}

/* «Повторить · N» and «Продолжить» in ochre with the dark text of the header; as
   specific as Pico's hover rule, and later, so it holds in every state. */
.words-aside .practice :is([data-start-words], [data-continue]) {
  --pico-background-color: var(--och);
  --pico-border-color: var(--och);
  --pico-color: var(--hd);
  min-height: 44px;
}

/* «Прервать» outlined in the muted text colour of the header; more specific than the hover rule
   of a secondary outline button in the base region. */
.words-aside .practice button.secondary.outline[data-abort] {
  --pico-background-color: transparent;
  --pico-border-color: var(--hdm);
  --pico-color: var(--hdi);
  min-height: 44px;
}

/* «Собрать упражнения» (section 11, v17): light on the dark header, as «Разбор урока» of
   the tab «Уроки»; while inactive, its reason under it in the muted colour of the header. */
.words-collect {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.words-collect form {
  margin: 0;
}

.words-aside .words-collect-button {
  --pico-background-color: var(--hdi);
  --pico-border-color: var(--hdi);
  --pico-color: var(--hd);
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0 16px;
}

.words-collect-note {
  margin: 0;
  color: var(--hdm);
  font-size: 0.875rem;
}

/* The job of kind «words» under the header: its card (the job card of the tab «Уроки»)
   while it runs or waits, then a line with its outcome and its button. */
.words-jobs {
  margin-bottom: var(--pico-spacing);
}

.words-job-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: var(--pico-spacing);
  padding: 12px 16px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
}

.words-job-line p {
  margin: 0;
  overflow-wrap: anywhere;
}

.words-job-line form,
.words-job-line .practice {
  margin: 0;
}

.words-job-line button,
.words-job-line [role="button"] {
  min-height: 44px;
  margin: 0;
}

.words-job-failed {
  border-color: var(--org);
}

/* «Нарисовать картинки · N» (#1200): in the place of the line of the job, without its
   frame; the reason in the pause is a line of its own. */
.words-images-offer {
  padding: 0;
  border: 0;
  background: none;
}

.words-job-failed [data-job-error] {
  color: var(--orgi);
}

.words-job-log {
  flex-basis: 100%;
  margin: 0;
}

.words-job-log > summary {
  min-height: 44px;
  margin-block: 0;
  padding-block: 11px;
}

.words-job-log pre {
  max-height: 16rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.words-added {
  padding: 0.5rem 0.75rem;
  border-radius: var(--pico-border-radius);
  background: var(--blus);
  color: var(--blu);
}

/* The search and the chips (section 11, sketch 150, #1734). «+ Добавить слова» stands
   in the top right corner of the toolbar (its summary is absolute): the search leaves
   it that width, the row of chips runs under both, and the body of the block opens
   under them across the whole width. */
.words-toolbar {
  --add-w: 11.5rem;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 0;
  min-height: 44px;
  margin-bottom: var(--pico-spacing);
}

.word-search {
  flex: 1 1 100%;
  min-width: 0;
  margin: 0;
  padding-right: calc(var(--add-w) + 8px);
}

.word-search .filter-q {
  width: 100%;
  height: 44px;
  margin: 0;
  padding-block: 0;
}

/* Pico rounds a search field into a pill; here it is a field like the others. */
.word-search input.filter-q[type="search"] {
  --pico-border-radius: inherit;
}

/* The row of chips; on a phone it scrolls sideways (below). It is the containing
   block of nothing: the menus of a phone open under it from .word-chips. */
.word-chips {
  position: relative;
  flex: 1 1 100%;
  min-width: 0;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* A chip: a pill in --sf with a frame; with a value filled as the main button and
   written in its colour, the cross beside the value. */
.chip {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--ln);
  border-radius: 19px;
  background: var(--sf);
  color: var(--ink);
  font-size: 0.875rem;
  line-height: 1.2;
  white-space: nowrap;
}

.chip.chip-on {
  border-color: var(--btn);
  background: var(--btn);
  color: var(--btni);
  font-weight: 600;
}

.chip-menu {
  position: relative;
  margin: 0;
}

.chip-face {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  margin: 0;
  padding: 0 12px;
  border-radius: 19px;
  color: inherit;
  text-decoration: none;
  list-style: none;
  cursor: pointer;
}

a.chip-face:hover {
  color: inherit;
}

.chip-face::-webkit-details-marker {
  display: none;
}

/* Pico draws its arrow after a summary and spaces an open one from its body. */
.chip-menu > summary::after,
.chip-sub > summary::after {
  display: none;
}

.chip-menu[open] > summary,
.chip-sub[open] > summary {
  margin-bottom: 0;
}

/* Pico colours a summary by the state of its details; a chip, an item and the order
   keep their own colour. */
.word-chips details > summary.chip-face:not([role]),
.word-chips details[open] > summary.chip-face:not([role]):not(:focus) {
  color: inherit;
}

.word-chips details > summary.chip-item:not([role]),
.word-chips details[open] > summary.chip-item:not([role]):not(:focus) {
  color: var(--ink);
}

.words-listhead details > summary.sort-face:not([role]),
.words-listhead details[open] > summary.sort-face:not([role]):not(:focus) {
  color: var(--blu);
}

.chip-face:focus-visible {
  outline-offset: -3px;
}

.chip-on .chip-menu .chip-face {
  padding-right: 2px;
}

.chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  min-height: 36px;
  padding-right: 4px;
  border-radius: 0 19px 19px 0;
  color: inherit;
  font-size: 1.125rem;
  line-height: 1;
  text-decoration: none;
}

a.chip-x:hover {
  color: inherit;
}

/* «Отмеченные» is one link: its cross stands inside it. */
.chip-face .chip-x {
  width: auto;
  min-height: 0;
  padding: 0 0 0 2px;
}

:is(.chip-face, .chip-x, .chip-item, .chip-reset, .sort-face, .period-quick a, .period-arrow, .period-day a):focus-visible {
  outline: 3px solid var(--fcs);
  outline-offset: 1px;
}

.chip-slot:empty,
.words-unmark:empty {
  display: none;
}

/* «Сбросить» at the end of the row, from two chips with a value. */
.chip-reset {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 38px;
  padding: 0 6px;
  color: var(--blu);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

/* The menu of a chip: a card under it with a shadow, over the list. Its text is not
   the colour of a filled chip. */
.chip-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 15rem;
  margin: 0;
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: var(--sf);
  box-shadow: 0 12px 32px color-mix(in srgb, var(--ink) 18%, transparent);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 400;
  white-space: normal;
}

.chip-list,
.chip-list li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip-pop.chip-list {
  padding: 4px 0;
}

.chip-list li.chip-sep {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--ln2);
}

/* An item: a line of 40 px with room for the check of the current one on the left and
   the number of words of a lesson on the right. */
.chip-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 0 14px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.chip-item:hover {
  background: var(--sf2);
  color: var(--ink);
}

.chip-item::before {
  content: "";
  flex: none;
  width: 14px;
  color: var(--blu);
  font-weight: 600;
}

.chip-item[aria-current]::before {
  content: "✓";
}

.chip-item[aria-current] {
  font-weight: 600;
}

.chip-item em {
  margin-left: auto;
  padding-left: 16px;
  color: var(--mut);
  font-size: 0.8125rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

/* «Ранние уроки ›» opens the earlier lessons under it, indented. */
.chip-sub {
  margin: 0;
}

.chip-sub > summary.chip-item {
  list-style: none;
}

.chip-sub > summary::-webkit-details-marker {
  display: none;
}

.chip-sub .chip-list {
  padding-left: 16px;
}

/* «Снять все отметки» by «Отмеченные» (#1074): the summary asks first, then the
   question and «Да, снять» follow it on the line. */
.words-unmark {
  flex: none;
}

.unmark-confirm {
  margin: 0;
}

.unmark-confirm > summary {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  color: var(--blu);
  font-size: 0.875rem;
  text-decoration: underline;
  text-decoration-color: var(--pico-primary-underline);
  text-underline-offset: 0.125em;
  white-space: nowrap;
  cursor: pointer;
}

.unmark-confirm > summary::after {
  display: none;
}

.unmark-confirm[open] > summary {
  margin-bottom: 0;
}

.unmark-confirm[open] {
  display: inline-flex;
  align-items: center;
}

.unmark-body {
  display: inline-flex;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 0 12px;
  color: var(--ink);
  font-size: 0.875rem;
  white-space: nowrap;
}

.unmark-body button {
  width: auto;
  min-height: 38px;
  margin: 0;
  padding-block: 0;
}

/* The panel of «Период» (sketch 151): the quick choice, the month with its arrows,
   the days in a table, the legend and the hint or the total. */
.period-panel {
  display: grid;
  gap: 10px;
  width: 22.5rem;
  padding: 12px 14px;
}

.period-quick,
.period-quick li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.period-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.period-quick a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--ln);
  border-radius: 16px;
  color: var(--ink);
  font-size: 0.8125rem;
  text-decoration: none;
  white-space: nowrap;
}

.period-quick a[aria-current] {
  border-color: var(--btn);
  background: var(--btn);
  color: var(--btni);
  font-weight: 600;
}

.period-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.period-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 18px;
  color: var(--blu);
  font-size: 1.375rem;
  line-height: 1;
  text-decoration: none;
}

a.period-arrow:hover {
  background: var(--sf2);
}

span.period-arrow {
  color: var(--fnt);
}

/* The month: rows of seven columns, not a table, so the table of the words stays the
   only one of the page. */
.period-weekdays,
.period-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  text-align: center;
}

.period-weekdays {
  padding-bottom: 4px;
  color: var(--mut);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.period-week > .period-day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
}

/* A day: a round link; the band of the span is the --blus of its cells, rounded at
   its ends and at the ends of a week; the ends are filled as a chosen chip. */
.period-day a,
.period-day .period-future {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 17px;
  color: var(--ink);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.period-day .period-future {
  color: var(--fnt);
}

.period-day a:hover {
  background: var(--sf2);
}

.period-day[data-period-dot] a::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--blu);
}

.period-week > .is-within {
  background: var(--blus);
}

.period-week > .is-within:first-child,
.period-week > .is-start {
  border-top-left-radius: 19px;
  border-bottom-left-radius: 19px;
}

.period-week > .is-within:last-child,
.period-week > .is-end {
  border-top-right-radius: 19px;
  border-bottom-right-radius: 19px;
}

.period-day.is-today a {
  box-shadow: inset 0 0 0 1px var(--blu);
}

.period-day:is(.is-start, .is-end) a {
  background: var(--btn);
  color: var(--btni);
  font-weight: 600;
}

.period-day:is(.is-start, .is-end)[data-period-dot] a::after {
  background: var(--btni);
}

.period-legend,
.period-hint,
.period-total {
  margin: 0;
  font-size: 0.8125rem;
}

.period-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--mut);
}

.period-dot {
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--blu);
}

.period-hint {
  color: var(--ochi);
  font-weight: 600;
}

.period-total {
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The order of the list as a line over the table on the right (#1734): a link of
   the colour of links, its menu under it from the right. */
.words-listhead {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 6px;
}

.sort-face {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  margin: 0;
  color: var(--blu);
  font-size: 0.875rem;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.sort-face::-webkit-details-marker {
  display: none;
}

.sort-menu .chip-pop {
  right: 0;
  left: auto;
  min-width: 12rem;
}

/* A word without attempts reads «новое» in the column of the level (#1734). */
.words-table .level-new {
  color: var(--mut);
  font-size: 0.8125rem;
}

.words-add {
  flex: 1 0 100%;
  margin: 0;
}

.words-toolbar .words-add > summary {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
  width: var(--add-w);
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  white-space: nowrap;
}

/* Without words there are no filters: the summary stays in the flow, on the right. */
.words-toolbar .words-add:first-child > summary {
  position: static;
  margin-left: auto;
}

.words-toolbar .words-add > summary[role="button"]::after {
  display: none;
}

/* The body of «Добавить слова» (#286): the card with the field of lines and the
   preview, one under the other; on a laptop side by side (below). */
.words-add-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 12px;
}

/* «Добавить «que»» under «Ничего не найдено» (#1201): a button of the base region,
   44 px high; a long query wraps instead of widening the page. */
.words-none-add [data-words-add-query] {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* The card of «Добавить «zapato»» (#1735): «Готовлю…» while its request runs, in place
   of the button and then of the card's own content; the word, its translation and
   example, in ochre what the model filled; «Сохранить» and «Править» in a row. */
.words-inline-wait {
  margin: 0;
  color: var(--mut);
}

:is(.words-none-add, .words-inline):not(.htmx-request) .words-inline-wait,
.words-none-add.htmx-request [data-words-add-query],
.words-inline.htmx-request .words-inline-body {
  display: none;
}

.words-inline :is(.inline-view, .inline-fields, [data-inline-edit])[hidden] {
  display: none;
}

.words-none-add .words-inline-wait {
  padding: 12px 16px;
}

.words-inline {
  max-width: 40rem;
  margin: 0;
  padding: 16px;
}

.words-inline-form {
  margin: 0;
}

.inline-word {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: baseline;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.inline-word strong {
  font-size: 1.125rem;
}

.inline-ru {
  color: var(--mut);
}

.inline-note {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

/* What the model filled itself: ochre, with the legend under the text. */
.words-inline .inline-added:not(label) {
  padding-inline: 4px;
  border-radius: 4px;
  background: var(--ochs);
  color: var(--ochi);
}

.words-inline label.inline-added :is(input, textarea) {
  background: var(--ochs);
}

.inline-legend {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--mut);
}

.inline-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid var(--och);
  border-radius: 3px;
  background: var(--ochs);
}

.words-inline .preview-comment {
  display: block;
  margin-bottom: 4px;
}

.inline-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 8rem;
  gap: 0 12px;
}

.inline-fields .inline-note-field {
  grid-column: 1 / -1;
}

.inline-fields textarea {
  field-sizing: content;
  min-height: 2lh;
  max-height: 6lh;
  resize: vertical;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.inline-actions button {
  width: auto;
  min-height: 44px;
  margin: 0;
}

@media (max-width: 575.98px) {
  .inline-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .inline-actions button {
    flex: 1 1 0;
  }
}

/* The lines of the field of «Добавить слова» with «новое» or «уже есть: …» (#1735). */
.words-lines-marks {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.words-lines-marks:empty {
  display: none;
}

.words-lines-marks li {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: baseline;
  margin: 0;
  padding: 2px 0;
  border-bottom: 1px solid var(--ln2);
  list-style: none;
  font-size: 0.875rem;
}

.words-lines-marks .lm-line {
  min-width: 0;
  overflow-wrap: anywhere;
}

.words-lines-marks .tag {
  flex: none;
}

/* The table: Испанский | Перевод | Уровень | Повторить | Откуда. A laptop of 1280px
   fits it; a narrower window scrolls it in its frame. Each word is a tbody: its row,
   then the row of its form. */
.words-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
}

.words-table :is(th, td) {
  padding: 8px 12px;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.words-table thead th {
  font-size: 0.8125rem;
}

.words-table thead th:nth-child(3) {
  width: 13rem;
}

.words-table thead th:nth-child(4) {
  width: 8rem;
}

.words-table thead th:nth-child(5) {
  width: 9.5rem;
}

.words-table thead th:nth-child(6) {
  width: 52px;
}

/* The star of a row (#1074): the mark of the word, filled in blue while it is set; the
   cell keeps the height of the row, on a phone the button is 44px. */
.table-frame .words-table .w-mark {
  padding-block: 0;
  text-align: center;
}

.word-mark {
  margin: 0;
}

.words-table .word-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--pico-border-radius);
  background: transparent;
  color: var(--mut);
}

.words-table .word-star:hover {
  background: var(--sf2);
  color: var(--blu);
}

.words-table .word-star[aria-pressed="true"] {
  color: var(--blu);
}

.words-table .word-star[aria-pressed="true"] svg {
  fill: currentColor;
}

/* The word and its translation (#783): the summary of the details of the word across
   the first two columns, the whole of both cells is its target. Not a button but a
   link by the rule of 2.1: the Spanish form in the colour and underline of the links
   of the page, the translation in the text colour, a hand for the cursor. The two
   columns of its grid stand under the two headers: the gap is the padding of two
   cells. As specific as the rules of Pico for [role=button] and of the base region,
   and later. */
.table-frame .words-table .w-word .word-edit > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  width: auto;
  margin: -8px -12px;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
  color: var(--ink);
  font-weight: inherit;
  font-size: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
}

.table-frame .words-table .w-word .word-edit > summary:focus-visible {
  box-shadow: inset 0 0 0 var(--pico-outline-width) var(--pico-primary-focus);
}

.table-frame .words-table .w-word .word-edit > summary::after {
  display: none;
}

.words-table .w-es strong {
  color: var(--blu);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--pico-primary-underline);
  text-underline-offset: 0.125em;
}

.words-table .word-edit > summary:hover .w-es strong {
  text-decoration-color: var(--blu);
}

/* «Ещё принимаются» (v38, #1406): grey under the Spanish form, a smaller line. */
.words-table .w-alt {
  display: block;
  margin-top: 2px;
  color: var(--mut);
  font-size: 0.8125rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* The picture of the word (v28) before its Spanish form, 32px, on a phone too; the row
   does not grow on a phone: the picture hangs over the padding of the cell. */
.words-table .w-es .word-image {
  width: 32px;
  height: 32px;
  margin-block: -6px;
  margin-right: 6px;
  vertical-align: middle;
}

.words-table .w-level {
  white-space: nowrap;
}

.words-table .w-level .tag {
  margin-left: 6px;
  vertical-align: middle;
}

/* The heading of a day of adding (#1039): «2 ноября · 78 слов» over its words. */
.table-frame .words-table .words-day th {
  padding: 12px 12px 6px;
  background-color: var(--sf2);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.875rem;
}

.words-table :is(.w-repeat, .w-source) {
  color: var(--mut);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* «вручную 2 ноя»: the day of adding keeps its number and month together (#1039). */
.words-table .w-source time {
  white-space: nowrap;
}

.words-table .repeat-today {
  color: var(--org);
  font-weight: 600;
}

/* The column says «Повторить», so a cell shows the day alone; the word stays for a
   screen reader and comes back on a phone. */
@media (min-width: 576px) {
  .words-table .repeat-word {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

.words-table .word-edit {
  margin: 0;
}

/* The row of the form under its word, shown while the details of the word is open:
   after a tap on the word, or opened by app.js for the target of the address
   (/words#word-N, the link «Править» under the result of a word, #127). Without :has
   every form stays open: nothing is lost. */
.words-table .word-form-row {
  display: none;
}

.words-table tbody:has(.word-edit[open]) .word-form-row {
  display: table-row;
}

@supports not selector(:has(*)) {
  .words-table .word-form-row {
    display: table-row;
  }
}

.table-frame .words-table tbody:has(.word-edit[open]) > tr > td {
  background-color: var(--sf2);
}

.table-frame .words-table tbody:has(.word-edit[open]) .word-row > td {
  border-bottom-color: transparent;
}

.words-table tbody {
  scroll-margin-top: var(--pico-spacing);
}

.table-frame .words-table .word-form-row > td {
  padding: 4px 12px 12px;
}

/* The form across the whole table in rows: Испанский, Перевод, Часть речи; then
   Пример as wide as the form (#1048); then «отключено» on the left and «Сохранить» on
   the right (Значок is gone in v30, #1041). A phrase and the longest part of speech fit
   their fields at 1280px. */
.word-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 8px 16px;
  align-items: end;
  margin: 0;
}

.word-form .word-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  justify-self: start;
}

/* The last column of the grid: the third one on a laptop, the only one on a phone. */
.word-form button[data-word-save] {
  grid-column: -2 / -1;
  justify-self: end;
}

.word-form label {
  margin: 0;
  color: var(--mut);
  font-size: 0.8125rem;
}

.word-form :is(input:not([type="checkbox"]), select) {
  height: 44px;
  margin: 4px 0 0;
  padding-block: 0;
}

/* Пример: its own row, a textarea growing with its text from one line to four
   (field-sizing); a browser without it shows two rows (rows="2"). */
.word-form .word-note {
  grid-column: 1 / -1;
}

/* «Ещё принимаются» (#1406): its own row as wide as the form, before Пример. */
.word-form .word-alternatives {
  grid-column: 1 / -1;
}

.word-form textarea {
  min-height: 44px;
  max-height: calc(4 * 1.5em + 22px);
  margin: 4px 0 0;
  padding-block: 10px;
  resize: vertical;
  field-sizing: content;
}

.word-form .word-off {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--ink);
  font-size: 0.9375rem;
  white-space: nowrap;
}

.word-form .word-off input {
  margin: 0;
}

/* A card the admin hid (#1881): under the boxes, the whole row of the flags. */
.word-form .word-hidden {
  flex-basis: 100%;
  margin: 0 0 4px;
  color: var(--mut);
  font-size: 0.8125rem;
}

.word-form button {
  width: auto;
  min-height: 44px;
  margin: 0;
}

.words-error {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

/* The sound of the word under the form (#1411): «▶ Прослушать» and «Переозвучить» in a
   row, then «Переозвучено» or the reason of a failure. The player is that of an
   exercise (_audio_player.html, app.js), its button styled here as in the card. */
.word-voice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 8px 0 0;
}

.word-voice form {
  margin: 0;
}

.word-voice .listen-play[hidden],
.word-voice .listen-status[hidden],
.word-voice .listen-player audio[hidden] {
  display: none;
}

.word-voice .listen-player audio {
  display: block;
  max-width: 100%;
}

.word-voice .listen-play,
.word-voice button[data-word-revoice] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0 12px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
}

.word-voice .listen-play[data-listen-state="loading"] {
  color: var(--mut);
}

.word-voice .listen-icon {
  color: var(--blu);
  font-size: 0.875em;
}

.word-voice .listen-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 12px;
  margin: 4px 0 0;
  color: var(--org);
  font-size: 0.875rem;
}

.word-voice .listen-status a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.word-voice-status {
  margin: 0;
  color: var(--mut);
  font-size: 0.875rem;
}

.word-voice .form-error {
  flex-basis: 100%;
  margin: 0;
  overflow-wrap: anywhere;
}

/* A disabled word: grey and struck through, its Spanish form too; it opens like any
   other. */
.words-table .word-disabled :is(.w-es, .w-ru),
.words-table .word-disabled .w-es strong {
  color: var(--fnt);
  text-decoration: line-through;
}

.words-table .word-disabled :is(.w-repeat, .w-source) {
  color: var(--fnt);
}

.words-table .word-disabled .level-bar {
  opacity: 0.5;
}

/* A phone: the search and «+» in one row, the chips under them in a row scrolled
   sideways (#1734); the table is a list in its frame: the word and its translation, a tap on them opens the form, then
   the meta line with the bar and «повторить …», then the source. */
@media (max-width: 575.98px) {
  .words-summary {
    gap: 16px;
  }

  .words-toolbar {
    --add-w: 44px;
  }

  /* The chips in one row under the search, scrolled sideways, no button of the
     filters (#1734); 44 px to tap. The row is not positioned, so a menu, absolute
     from .word-chips, is not cut by its scrolling and opens across the width under
     it. */
  .chips-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .chips-row::-webkit-scrollbar {
    display: none;
  }

  .chip,
  .chip-reset,
  .unmark-confirm > summary {
    min-height: 44px;
  }

  .chip {
    border-radius: 22px;
  }

  .chip-face,
  .chip-x {
    min-height: 42px;
  }

  .chip-x {
    width: 36px;
  }

  .unmark-body button {
    min-height: 44px;
  }

  .chip-menu {
    position: static;
  }

  .sort-menu {
    position: relative;
  }

  .chip-pop {
    right: 0;
    min-width: 0;
  }

  .period-panel {
    width: auto;
  }

  .period-quick a,
  .period-arrow {
    min-height: 44px;
  }

  .period-arrow {
    width: 44px;
  }

  .period-quick a {
    border-radius: 22px;
  }

  .period-week > .period-day {
    height: 44px;
  }

  .period-day a,
  .period-day .period-future {
    width: 40px;
    height: 40px;
    border-radius: 20px;
  }

  .chip-item,
  .sort-face {
    min-height: 44px;
  }

  .words-toolbar .words-add > summary {
    padding: 0;
    font-size: 1.25rem;
  }

  .words-toolbar .words-add > summary .add-label {
    display: none;
  }

  .words-table {
    min-width: 0;
  }

  .words-table,
  .words-table tbody,
  .words-table tr,
  .words-table td {
    display: block;
  }

  .words-table thead {
    display: none;
  }

  /* The heading of a day of adding takes the whole width of the list (#1039). */
  .words-table .words-day th {
    display: block;
  }

  .words-table tbody + tbody {
    border-top: 1px solid var(--ln2);
  }

  .table-frame .words-table :is(td, th) {
    padding: 0;
    border: 0;
    background-color: transparent;
  }

  .table-frame .words-table tbody:has(.word-edit[open]) > tr > td {
    background-color: transparent;
  }

  /* The word being edited and its form share one --sf2 band. */
  .words-table tbody:has(.word-edit[open]) {
    background-color: var(--sf2);
  }

  .words-table .word-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 10px 12px;
  }

  /* The word and its translation take the first line with the star on the right; the
     summary is a tap target of 44px across the row, within a line of 24px, and so is
     the star (#1074). */
  .words-table .w-word {
    flex: 1 0 calc(100% - 54px);
    order: 0;
    min-width: 0;
  }

  .words-table .w-mark {
    flex: none;
    order: 1;
    margin: -10px -12px -10px 0;
  }

  .words-table .word-star {
    width: 44px;
    height: 44px;
  }

  .table-frame .words-table .w-word .word-edit > summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    min-height: 44px;
    margin: -10px 0 -10px -12px;
    padding: 0 0 0 12px;
  }

  .words-table .w-ru {
    color: var(--mut);
  }

  /* The grey lines under the word («Ещё принимаются», «по форме: tuve» of #1570) go
     under the word and its translation, each on a line of its own: the translation
     stays right after the word, where it is in the other rows. */
  .words-table .w-es {
    display: contents;
  }

  .words-table .w-es .w-alt {
    flex: 1 1 100%;
    order: 1;
    margin-top: 0;
  }

  /* The picture is an item of the line now: the gap of 10px less 4px keeps its 6px. */
  .words-table .w-es .word-image {
    margin-right: -4px;
  }

  .words-table .w-level {
    order: 3;
  }

  .words-table .w-repeat {
    order: 4;
  }

  .words-table .w-repeat:empty {
    display: none;
  }

  /* The source always takes a line of its own, so every row has the same three lines:
     the word, the bar with «повторить …», the source. The link to the digest is a tap
     target of 44px within a line of 32px. */
  .words-table .w-source {
    display: flex;
    flex: 1 0 100%;
    order: 5;
    align-items: center;
    min-height: 32px;
  }

  .words-table .w-source a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-block: -6px;
  }

  .words-table tbody:has(.word-edit[open]) .word-form-row {
    display: block;
  }

  .table-frame .words-table .word-form-row > td {
    padding: 0 12px 12px;
  }

  .word-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .word-form button {
    width: 100%;
  }
}

/* «Добавить слова»: the field of lines and its preview (#286). */

.words-lines {
  margin: 0;
  padding: 16px;
}

.words-lines label {
  margin-bottom: 4px;
  font-weight: 600;
}

.words-lines textarea {
  margin-bottom: 4px;
  resize: vertical;
}

/* Pico pulls a small after a field up by 0.75 of its spacing, which under the 4px
   margin of the field put the frame over the first line of the hint (#344). */
.words-lines-hint {
  display: block;
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--mut);
}

.words-lines button {
  width: 100%;
  margin: 0;
}

.words-wait:not(.htmx-request) {
  display: none;
}

.words-wait {
  margin: calc(0.5 * var(--pico-typography-spacing-vertical)) 0 0;
  color: var(--pico-muted-color);
}

.words-preview > :last-child {
  margin-bottom: 0;
}

.preview-form {
  margin: 0;
}

/* The head of the preview: «выбрано N из M» and «модель дополнила N строк». */
.preview-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-bottom: 8px;
  color: var(--mut);
  font-size: 0.875rem;
}

.preview-head strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* The cards of the preview (#1048): a card per line, no scroll of its own. The first
   row is the check | Испанский | Перевод | Вид (Значок is gone in v30, #1041), the
   second Пример from the
   column of Испанский to the right edge, the comment of the model under it. The
   check takes the left strip of the card, all of it toggles the row. The head of the
   columns above the cards follows the same grid. The cards are a container: a preview
   narrower than the first row needs (a phone, a narrow window) has three rows, below. */
.preview-cards {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  container: preview / inline-size;
}

.preview-cols,
.preview-row {
  display: grid;
  grid-template-columns: 44px minmax(10rem, 1fr) minmax(12rem, 1.5fr) 7.5rem;
  grid-template-areas:
    "pick es ru kind"
    "pick note note note";
  gap: 8px;
  align-items: start;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--pico-border-radius);
}

.preview-row {
  border-color: var(--ln);
  background: var(--sf);
}

.preview-cols {
  grid-template-areas: "pick es ru kind";
  padding-block: 0;
  color: var(--mut);
  font-size: 0.8125rem;
  font-weight: 600;
}

.preview-cards .p-pick {
  grid-area: pick;
  align-self: stretch;
}

.preview-cards .p-es {
  grid-area: es;
}

.preview-cards .p-ru {
  grid-area: ru;
}

.preview-cards .p-kind {
  grid-area: kind;
}

.preview-cards .p-note {
  grid-area: note;
}

.preview-row :is(input:not([type="checkbox"]), select) {
  height: 40px;
  min-width: 0;
  margin: 0;
  padding-block: 0;
  font-size: 0.9375rem;
}

/* Пример grows with its text from one line to four (field-sizing); a browser without
   it shows two rows (rows="2"). */
.preview-row textarea {
  min-height: 40px;
  max-height: calc(4 * 1.5em + 18px);
  margin: 0;
  padding-block: 8px;
  font-size: 0.9375rem;
  resize: vertical;
  field-sizing: content;
}

/* The check of a row: its label fills the left strip of the card, so a tap anywhere in
   it toggles the row; the box stands level with the fields of the first row. */
.preview-row label.preview-pick {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding-top: 10px;
  cursor: pointer;
}

.preview-row label.preview-pick input {
  margin: 0;
}

/* What the model filled itself: the field on --blus. */
.preview-row .preview-added :is(input, textarea, input:focus, textarea:focus) {
  --pico-form-element-background-color: var(--blus);
  --pico-form-element-active-background-color: var(--blus);
  --pico-form-element-focus-color: var(--fcs);
}

/* A row already in words: unchecked, muted, tagged «уже есть» in ochre. */
.preview-row-exists :is(input:not([type="checkbox"]), select, textarea) {
  --pico-color: var(--fnt);
  --pico-form-element-placeholder-color: var(--fnt);
  color: var(--fnt);
}

.preview-row-exists :is(input, textarea)::placeholder {
  color: var(--fnt);
  opacity: 1;
}

.preview-row .tag {
  margin-top: 4px;
}

/* A narrow preview, three rows (design 2026-11-03, section 91): the check and
   Испанский; Перевод and Вид side by side; Пример across the card.
   The head of the columns has no place there. */
@container preview (max-width: 639.98px) {
  .preview-cols {
    display: none;
  }

  .preview-row {
    grid-template-columns: 44px minmax(0, 1fr) 6.5rem;
    grid-template-areas:
      "pick es es"
      "ru ru kind"
      "note note note";
  }

  .preview-cards .p-pick {
    align-self: start;
  }

  /* Вид in its 6.5rem: Pico's padding of a select (about 53px with the chevron) left
     «слово» and «фраза» cut; narrower paddings keep the chevron and the whole word. */
  .preview-row .p-kind select {
    padding-inline: 8px 28px;
    background-position: center right 8px;
  }
}

/* The comment of the model under Пример; Pico's small after a field keeps a spacing
   under it, which would stand empty at the bottom of the card. */
.preview-comment {
  display: block;
  margin-top: 4px;
  margin-bottom: 0;
  color: var(--pico-muted-color);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

/* The foot: the caption of the highlight and «Сохранить N». */
.preview-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: space-between;
}

.preview-note {
  display: flex;
  flex: 1 1 16rem;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--mut);
  font-size: 0.875rem;
}

.preview-swatch {
  flex: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--ln);
  border-radius: 3px;
  background: var(--blus);
}

.preview-foot button {
  width: auto;
  min-height: 44px;
  margin: 0 0 0 auto;
}

/* A laptop: the field of lines on the left, the preview on the right. */
@media (min-width: 1024px) {
  .words-add-body {
    grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
  }
}

@media (max-width: 575.98px) {
  .preview-foot button {
    width: 100%;
  }
}

/* «N флагов» in the header of «Слова»: a link to the tab «Слова» of the page of flags. */
.words-summary .words-flags-link {
  color: inherit;
}

/* The page of flags (v38, #1409): a card per flag, the lines of the word, the attempt,
   the reason and the comment, then «Править» (the form of the card unfolds under the
   buttons) and «Снять». The tabs take the look of the tabs of «Логи». */
.flag-list {
  margin: 0;
  padding: 0;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  list-style: none;
}

.flag-list > .flag-card {
  margin: 0;
  padding: 12px 16px;
  list-style: none;
}

.flag-list > .flag-card + .flag-card {
  border-top: 1px solid var(--ln2);
}

.flag-card p {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.flag-card .flag-ru,
.flag-card .flag-line {
  color: var(--mut);
}

.flag-card .flag-line {
  font-size: 0.875rem;
}

.flag-card .flag-comment {
  padding: 6px 10px;
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
  white-space: pre-wrap;
}

.flag-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.flag-actions .flag-edit {
  margin: 0;
}

/* «Править» and «Снять» as the secondary buttons of a result row (session region). */
.flag-card .flag-actions .flag-edit > summary,
.flag-card .flag-actions button {
  display: flex;
  align-items: center;
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
}

.flag-card .flag-actions .flag-edit > summary::after {
  display: none;
}

/* Where ::details-content is unknown, an open «Править» goes under «Снять» whole;
   elsewhere the buttons stay in the row and only the form goes under it, as the
   foldouts of a result do. */
.flag-actions .flag-edit[open] {
  flex-basis: 100%;
  order: 2;
}

.flag-actions .flag-edit[open] > .word-form {
  margin-top: 8px;
}

@supports selector(::details-content) {
  .flag-actions .flag-edit,
  .flag-actions .flag-edit[open] {
    display: contents;
  }

  .flag-actions .flag-edit::details-content {
    flex-basis: 100%;
    order: 2;
  }

  .flag-actions .flag-edit:not([open])::details-content {
    display: none;
  }
}

.flag-actions .flag-resolve {
  margin: 0;
}

/* The two groups of the queue of the admin (#1773): «Флаги слов» and «Новые карточки». */
.flag-group {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.flag-list + .flag-group,
[data-flags-none] + .flag-group {
  margin-top: 24px;
}

.flag-note {
  margin-top: 12px;
  color: var(--mut);
  font-size: 0.875rem;
}

/* === lessons === */

/* «Уроки» and a digest (#288): the digests as rows of one card, the card of a lesson
   analysis with its stages as tiles, a digest with its sections folded in a card and
   «Что повторить», the notes and «Уточнить разбор» beside them. Buttons in the header
   stand on --hd in both themes, so they take its own colours. */

/* An ID of the map in backquotes is a link to its reference page: it takes the link
   colour and underline, so it does not pass for plain code. */
.lesson a code,
.lesson-summary a code {
  color: var(--blu);
  text-decoration: underline;
}

.lesson a:hover code,
.lesson-summary a:hover code {
  color: var(--blu);
}

.lesson-meta {
  color: var(--mut);
}

/* The session by the lesson: the count next to «Продолжить», the line under the button. */
[data-lesson-practice] [data-progress],
.lesson-past {
  color: var(--mut);
}

/* The header of the list: «Разбор урока» on the right of the title, a light button on
   the dark band; the form unfolds under it as a panel over the page. */
.lesson-analysis {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.lesson-analysis .analysis-busy,
.analysis-form > summary[role="button"] {
  --pico-background-color: var(--hdi);
  --pico-border-color: var(--hdi);
  --pico-color: var(--hd);
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 40px;
  margin: 0;
  padding: 0 16px;
}

.lesson-analysis .analysis-note {
  margin: 0;
  color: var(--hdm);
  font-size: 0.875rem;
}

/* On a laptop the form is a panel over the page under the button, flush with its right
   edge; on a phone it stays in the flow of the header. Why a job did not start is said
   inside it. */
.analysis-form {
  position: relative;
  margin: 0;
  border: 0;
  padding: 0;
}

.analysis-form > form {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  width: min(420px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
  color: var(--ink);
  text-align: left;
}

.analysis-form > form > :last-child {
  margin-bottom: 0;
}

.analysis-form select {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The recordings as checkboxes (v16, the queue): a long name wraps under its box. */
.analysis-recordings {
  max-height: 16rem;
  overflow-y: auto;
}

.analysis-recordings label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  overflow-wrap: anywhere;
}

.analysis-recordings input[type="checkbox"] {
  flex: none;
  margin-top: 0.2em;
}

/* The line of the queue under the card: «в очереди:», then each lesson with «Отменить». */
.job-queue:not(:empty) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: var(--pico-spacing);
  color: var(--mut);
}

.job-queue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
}

.job-queue-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  list-style: none;
  color: var(--ink);
}

/* The card of a job: the title with its state and «Отменить», the stages as tiles
   (done with its time, the running one in ochre, a pending one dashed), the bar in
   ochre and the line of the step. A running job is framed in ochre, a failed one in
   orange. */
.lesson-jobs {
  margin-bottom: var(--pico-spacing);
}

.job-busy {
  color: var(--mut);
  overflow-wrap: anywhere;
}

.job-card {
  margin-bottom: var(--pico-spacing);
}

.job-card[data-job-status="running"] {
  border-color: var(--och);
}

.job-card.job-failed {
  border-color: var(--org);
}

.job-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 16px;
}

.job-head h2 {
  margin: 0;
  font-size: 1.125rem;
}

.job-state {
  margin: 2px 0 0;
  color: var(--mut);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.job-failed .job-state {
  color: var(--orgi);
}

.job-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
  padding: 0;
}

.job-stages .job-stage {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 6px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf2);
  list-style: none;
}

.job-stage-name {
  font-weight: 600;
}

.job-stage-state {
  color: var(--mut);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.job-stages .job-stage[data-stage-status="running"] {
  border-color: var(--och);
  background: var(--ochs);
}

.job-stages .job-stage[data-stage-status="pending"] {
  border-style: dashed;
  background: var(--sf);
}

.job-stages .job-stage[data-stage-status="failed"] {
  border-color: var(--orgl);
  background: var(--orgs);
}

.job-icon-done {
  color: var(--blu);
}

.job-icon-running {
  color: var(--ochi);
}

.job-icon-failed {
  color: var(--org);
}

.job-icon-pending,
.job-icon-skipped,
.job-icon-cancelled {
  color: var(--mut);
}

.job-card progress {
  --pico-progress-color: var(--och);
  --pico-progress-background-color: var(--trk);
}

.job-card [data-job-line] {
  color: var(--mut);
  overflow-wrap: anywhere;
}

/* «Последние строки лога»: a row of 44px, not the negative margins of the base. */
.job-card details[data-job-log] > summary {
  min-height: 44px;
  margin-block: 0;
  padding-block: 11px;
}

.job-card pre {
  max-height: 16rem;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.job-error {
  color: var(--orgi);
}

/* The list: the digests as rows of one card, the action of the lesson on the right. */
.lesson-list {
  margin-bottom: var(--pico-spacing);
}

.lesson-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 24px;
  align-items: start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--ln2);
}

.lesson-row:last-child {
  border-bottom: 0;
}

.lesson-row h2 {
  margin: 0 0 2px;
  font-size: 1.0625rem;
}

/* The date is a link of one line: padding makes its tap target 44px, the negative
   margin keeps the row as it was. */
.lesson-row h2 a {
  display: inline-block;
  margin-block: -12px;
  padding-block: 12px;
  color: var(--ink);
  text-decoration: none;
}

.lesson-row h2 a:hover {
  text-decoration: underline;
}

.lesson-row .lesson-meta {
  margin: 0 0 6px;
  font-size: 0.875rem;
}

.lesson-row .lesson-summary > :last-child,
.lesson-row [data-digest-errors],
.lesson-row [data-digest-no-json] {
  margin-bottom: 0;
}

/* The problems of a broken digest in orange, in its row and on its page alike. */
.lesson-row-broken [data-digest-errors],
.lesson-row-broken [data-digest-no-json],
.lesson-broken [data-digest-errors],
.lesson-broken [data-digest-no-json] {
  color: var(--orgi);
}

.lesson-row-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.lesson-row-action .practice {
  justify-content: flex-end;
  margin: 0;
}

.lesson-row-action .lesson-past {
  margin: 0;
  font-size: 0.8125rem;
  text-align: right;
}

/* The header of a digest: «Уроки / clase 9 · 64 мин», the title, then the topics; they
   come before the h1 in the markup and after it here. On the right the buttons of the
   lesson: «Закрепить урок» and «Слова урока · N» in ochre, «Прервать» outlined on the band. */
div:has(> .lesson-head-topics) {
  display: flex;
  flex-direction: column;
}

.lesson-head-topics {
  order: 1;
  margin: 6px 0 0;
}

.lesson-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  color: var(--hdm);
}

.lesson-actions .practice {
  justify-content: flex-end;
  margin: 0;
}

/* Both starts of a session over the lesson (#699), «Продолжить» and «Построить
   упражнения» in ochre with the dark text of the header. */
.lesson-actions :is([data-start-lesson], [data-start-words], [data-continue], [data-build-exercises]) {
  --pico-background-color: var(--och);
  --pico-border-color: var(--och);
  --pico-color: var(--hd);
}

/* «Прервать» outlined in the muted colour of the header with its light text, as on the
   page «Слова»: more specific than Pico's rules of a secondary outline button, hover,
   focus and press included, whose --ink text is dark on the band in the light theme. */
.lesson-actions .practice button.secondary.outline[data-abort] {
  --pico-background-color: transparent;
  --pico-border-color: var(--hdm);
  --pico-color: var(--hdi);
}

.lesson-actions [data-progress],
.lesson-actions .lesson-past,
.lesson-actions .lesson-build {
  margin: 0;
  color: var(--hdm);
  font-size: 0.875rem;
  text-align: right;
}

/* Under the title (#527): once the header wraps the buttons under it, app.js marks the
   block data-below and the buttons stand in a row from the left edge, of one height;
   on a phone the second goes under the first from the same edge. The lines of the last
   session and of the queue follow under the row, and without the script the column
   stays. On the right of the title the column above is kept. */
.lesson-actions[data-below] {
  flex-flow: row wrap;
  align-items: stretch;
}

.lesson-actions[data-below] > .practice {
  justify-content: flex-start;
}

.lesson-actions[data-below] > .practice :is(form, button, [role="button"]) {
  height: 100%;
}

.lesson-actions[data-below] > :not(.practice) {
  flex-basis: 100%;
  order: 1;
  text-align: left;
}

/* Text on the band in the colour of the header in both themes: «Упражнений по уроку
   пока нет.», «Или из терминала». */
.lesson-actions p,
.lesson-actions summary {
  color: var(--hdm);
}

.lesson-build p {
  margin-bottom: 6px;
}

.lesson-build details[data-terminal] {
  margin: 6px 0 0;
  border: 0;
  padding: 0;
}

.lesson-build details[data-terminal] > summary {
  display: inline-block; /* the chevron next to the words, not at the edge */
  margin: 0;
  padding: 0;
  color: inherit;
  font-size: 0.875rem;
}

.lesson-build details[data-terminal] > summary::after {
  display: inline-block;
  float: none;
  margin-inline-start: 0.25rem;
  vertical-align: middle;
}

.lesson-build details[data-terminal] code {
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

/* A digest: the sections in a card on the left, the column on the right; on a phone
   «Что повторить» above the sections, the notes and «Уточнить разбор» under them. */
.lesson {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px 32px;
  align-items: start;
}

@media (min-width: 768px) {
  .lesson {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "main review"
      "main side";
  }

  .lesson-main {
    grid-area: main;
  }

  .lesson-review {
    grid-area: review;
  }

  .lesson-side {
    grid-area: side;
  }
}

.lesson-main {
  padding: 16px 20px 4px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
}

.lesson-main > details {
  margin: 0;
  border-top: 1px solid var(--ln2);
}

.lesson-main > details > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin: 0;
  padding-block: 12px;
  font-size: 1.125rem;
  font-weight: 600;
}

.lesson-main > details[open] > summary {
  margin-bottom: 8px;
}

/* A section title is --ink, open or closed: Pico greys the summary of an open one. */
.lesson-main > details > summary:not([role]),
.lesson-main > details[open] > summary:not([role]):not(:focus),
.lesson-side details > summary:not([role]),
.lesson-side details[open] > summary:not([role]):not(:focus) {
  color: var(--ink);
}

/* The topics «###» of «Темы и акценты» smaller than the sections around them. */
.lesson-main > details > h3 {
  margin: 16px 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

/* An ID in a heading sits close to its brackets and never leaves them on a phone. */
.lesson-main h3 code {
  display: inline; /* Pico's inline-block lets a line break after the bracket */
  padding: 0 0.125rem;
  white-space: nowrap;
}

.lesson-main > details[open] {
  padding-bottom: 12px;
}

/* The title takes the free room: the number and the chevron stay on the right, with
   or without a number. */
.lesson-main > details > summary > .section-title {
  flex: 1;
}

.section-count {
  color: var(--mut);
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lesson-main > details[data-section="Где я ошибался"] .section-count {
  color: var(--org);
}

.lesson li form.inline {
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* «Где я ошибался»: each group a frame with its head on --sf2, the rule in a line, the
   mistakes with the time code on the left: what was said struck through in orange, the
   right form in bold, the translation, who corrected it in grey. */
.mistake-group {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
}

.mistake-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--ln2);
  background: var(--sf2);
}

.mistake-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.mistake-times {
  color: var(--orgi);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mistake-list {
  padding: 10px 14px 2px;
}

.mistake-rule {
  margin-bottom: 8px;
  color: var(--mut);
}

.mistake-items {
  margin-bottom: 8px;
  padding-left: 0;
}

.mistake-items > li {
  list-style: none;
}

.mistake {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 0 8px;
  margin-bottom: 8px;
}

.mistake-time {
  color: var(--mut);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  line-height: inherit;
}

.mistake-wrong {
  color: var(--org);
  text-decoration: line-through;
  text-decoration-color: var(--org);
}

.mistake-right {
  font-weight: 700;
}

.mistake-who {
  color: var(--mut);
}

/* The tiers of importance (#1716): the line of a tier above its groups, the groups
   below the highest tier folded under «Ещё N ошибок» after the open ones. */
.mistakes-lead[data-tier] {
  margin-bottom: 8px;
  color: var(--mut);
  font-size: 0.875rem;
  font-weight: 600;
}

.mistakes-more {
  margin-bottom: 8px;
}

/* A tap target of 44px at least, the chevron on the right as at the sections. */
.mistakes-more > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin: 0;
  padding-block: 10px;
}

/* Pico colours a summary by the state of its details: «Ещё N ошибок» keeps --btn. */
.mistakes-more > summary:not([role]),
.mistakes-more[open] > summary:not([role]):not(:focus) {
  color: var(--btn);
  font-weight: 500;
}

.mistakes-more[open] > summary {
  margin-bottom: 12px;
}

/* The table «Новые слова» on a phone: narrower cells, so three columns fit. */
@media (max-width: 575.98px) {
  .lesson td,
  .lesson th {
    padding-inline: 0.5rem;
  }
}

/* «Новые слова» and «Полезные фразы» drawn from the JSON (#702): a row per entry, the
   Spanish form, the translation and the example or note on the left; on the right the
   status in the dictionary as a word and its button, 44 px high on a phone. A disabled
   row is grey and struck through, as on the page «Слова». */
.dict-list {
  margin: 0;
  padding: 0;
}

.dict-list > .dict-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid var(--ln2);
  list-style: none;
}

.dict-list > .dict-row:first-child {
  border-top: 0;
}

.dict-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.dict-es {
  font-weight: 600;
}

.dict-ru::before {
  content: "— ";
  color: var(--mut);
}

.dict-note {
  display: block;
  color: var(--mut);
  font-size: 0.875rem;
}

.dict-mark {
  font-style: italic;
}

/* The reason «+ в словарь» added nothing (#1929): on --orgs, as .form-error. */
.dict-text .dict-error {
  display: block;
  margin-top: 4px;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.dict-detail + .dict-mark::before {
  content: "; ";
  font-style: normal;
}

.dict-status {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.dict-state {
  color: var(--mut);
  font-size: 0.875rem;
  white-space: nowrap;
}

.dict-row[data-status="in"] .dict-state {
  color: var(--blu);
}

.dict-status .dict-button {
  width: auto;
  min-height: 36px;
  margin: 0;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--ln);
  background-color: transparent;
  color: var(--ink);
  font-size: 0.875rem;
  white-space: nowrap;
}

.dict-status .dict-button:is(:hover, :focus-visible) {
  border-color: var(--mut);
  background-color: var(--sf2);
  color: var(--ink);
}

.dict-status .dict-remove {
  min-width: 36px;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.dict-off :is(.dict-es, .dict-ru) {
  color: var(--fnt);
  text-decoration: line-through;
}

.dict-off .dict-note {
  color: var(--fnt);
}

.dict-empty {
  margin: 0;
  color: var(--mut);
}

@media (max-width: 575.98px) {
  .dict-list > .dict-row {
    align-items: flex-start;
  }

  .dict-status .dict-button {
    min-height: 44px;
  }

  .dict-status .dict-remove {
    min-width: 44px;
  }
}

/* «Что повторить» beside the sections: the subtopics, each with «Дрилл». */
.lesson-review {
  margin: 0;
  padding: 12px 16px;
}

.lesson-review h2 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.lesson-review ul {
  margin: 0;
  padding: 0;
}

.lesson-review li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 6px 0;
  border-top: 1px solid var(--ln2);
  list-style: none;
}

.lesson-review li:first-child {
  border-top: 0;
}

.lesson-review li form.inline {
  margin: 0;
  flex: none;
}

/* «Заметки» and «Уточнить разбор»: folded cards in the column. */
.lesson-side details {
  margin: 0 0 12px;
  padding: 0 16px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--sf);
}

.lesson-side details > summary {
  min-height: 44px;
  margin: 0;
  padding-block: 11px;
  font-weight: 600;
}

.lesson-side details[open] {
  padding-bottom: 12px;
}

.lesson-side details[open] > summary {
  margin-bottom: 8px;
}

/* The notes to the analysis (#172): each block with its time, the text as it was
   entered, line breaks kept. */
.lesson-note .note-time {
  margin-bottom: 0.25rem;
  color: var(--mut);
}

.lesson-note .note-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lesson-refine textarea {
  resize: vertical;
}

/* A phone: the rows and the actions under their text, the stages one under another,
   the buttons of the header from the left edge. */
@media (max-width: 575.98px) {
  .lesson-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 16px;
  }

  .lesson-row-action,
  .lesson-actions,
  .lesson-analysis {
    align-items: flex-start;
  }

  .lesson-row-action .practice,
  .lesson-actions .practice {
    justify-content: flex-start;
  }

  .lesson-row-action .lesson-past,
  .lesson-actions [data-progress],
  .lesson-actions .lesson-past,
  .lesson-actions .lesson-build {
    text-align: left;
  }

  .analysis-form > form {
    position: static;
    margin-top: 8px;
  }

  .job-stages {
    grid-template-columns: minmax(0, 1fr);
  }

  .lesson-main {
    padding-inline: 14px;
  }

  .lesson-analysis .analysis-busy,
  .analysis-form > summary[role="button"] {
    min-height: 44px;
  }
}

/* === log === */

/* The tabs of «Логи» (section 11, #289): in the header of the page under the h1, through
   page_aside, a row of their own at the full width. Inactive --hdm, the current one
   white and underlined in ochre, as the sections of the header; the line lies on the
   bottom edge of the header, so the tabs step over its bottom padding. As a flex item
   of .page-head the row would grow to its content (min-width: auto) and push the page
   sideways on a phone (#1132); min-width: 0 keeps it inside the header. */
nav.log-tabs {
  flex-basis: 100%;
  min-width: 0;
  max-width: 100%;
  margin-bottom: -24px;
}

nav.log-tabs ul {
  flex-wrap: nowrap;
  gap: 0 4px;
  margin: 0;
}

nav.log-tabs li {
  padding: 0;
}

nav.log-tabs a {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin: 0;
  padding: 3px 12px 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: var(--hdm);
  text-decoration: none;
  white-space: nowrap;
}

nav.log-tabs li:first-child a {
  padding-inline-start: 0;
}

nav.log-tabs a:hover {
  color: var(--hdi);
}

nav.log-tabs a[aria-current="page"] {
  border-bottom-color: var(--och);
  color: var(--hdi);
  font-weight: 600;
}

.log-note {
  color: var(--mut);
  font-size: 0.875rem;
}

.log-kind {
  color: var(--mut);
}

/* The calendar of activity (#226) in a card (#289): a column is a week, Monday on top,
   the current week on the right; four shades of blue by ACTIVITY_STEPS, --trk without
   attempts, today outlined in ochre, the days to come paler. Days of 16px; on a phone
   10px with a 2px gap, so twelve weeks fit 390px without scrolling. The totals and the
   legend stand to the right of the grid, under it on a phone. */
.activity {
  --activity-empty: var(--trk);
  --activity-1: color-mix(in srgb, var(--blu) 30%, var(--trk));
  --activity-2: color-mix(in srgb, var(--blu) 55%, var(--trk));
  --activity-3: color-mix(in srgb, var(--blu) 80%, var(--trk));
  --activity-4: var(--blu);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 32px;
  margin-bottom: calc(var(--pico-spacing) * 1.5);
  padding: 20px 24px;
}

.activity-grid {
  --cell: 16px;
  --gap: 3px;
  max-width: 100%;
  overflow: hidden;
}

.activity-months,
.activity-days {
  display: grid;
  grid-template-columns: repeat(var(--weeks), var(--cell));
  gap: var(--gap);
}

.activity-months {
  margin-bottom: var(--gap);
  color: var(--mut);
  font-size: 0.6875rem;
  line-height: 1.2;
  white-space: nowrap;
}

/* The month of the current week, «ноя» in the first days of November, is wider than its
   column: it ends at the right edge of the grid and runs over the empty labels to its
   left, not past the edge, where the grid clipped it to «нс» (v30, #1044). */
.activity-months > span:last-child {
  justify-self: end;
}

.activity-days {
  grid-template-rows: repeat(7, var(--cell));
  grid-auto-flow: column;
}

.activity-day,
.activity-swatch {
  border-radius: 3px;
  background: var(--activity-empty);
}

.activity-day[data-future] {
  opacity: 0.4;
}

.activity-day[data-today] {
  outline: 2px solid var(--och);
  outline-offset: 1px;
}

:is(.activity-day, .activity-swatch)[data-step="1"] {
  background: var(--activity-1);
}

:is(.activity-day, .activity-swatch)[data-step="2"] {
  background: var(--activity-2);
}

:is(.activity-day, .activity-swatch)[data-step="3"] {
  background: var(--activity-3);
}

:is(.activity-day, .activity-swatch)[data-step="4"] {
  background: var(--activity-4);
}

.activity-side p {
  margin: 0;
}

.activity-side p + p {
  margin-top: 12px;
}

[data-activity-summary] > span:not(.visually-hidden) {
  display: block;
  color: var(--mut);
}

[data-activity-summary] b {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 600;
}

.activity-legend {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--mut);
  font-size: 0.75rem;
}

.activity-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
}

/* A day of the log is a card (#289): the head on --sf2 with the day on the left and
   its totals on the right, then a compact table of its sessions. The title of a
   session wraps, the numbers stay on one line. */
.log-day .log-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--ln);
  background: var(--sf2);
}

.log-day .log-day-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.log-day .log-day-head p {
  margin: 0;
  color: var(--mut);
  font-size: 0.875rem;
}

table.log {
  font-size: 0.875rem;
}

/* The padding of the cells as in the other tables of the app, on a phone too. */
table.log :is(th, td) {
  padding: 8px 12px;
}

table.log th[scope="row"] {
  min-width: 7rem;
}

table.log td {
  white-space: nowrap;
}

table.log td[data-session-status] {
  white-space: normal;
}

/* A status tag never breaks: «прервана на 7 из 10» stays one line. */
table.log td[data-session-status] .tag {
  white-space: nowrap;
}

/* On a laptop the columns of every day line up from card to card. */
@media (min-width: 576px) {
  .log-day table.log {
    table-layout: fixed;
  }

  .log-day table.log thead th:nth-child(2) {
    width: 18%;
  }

  .log-day table.log thead th:nth-child(3) {
    width: 22%;
  }

  .log-day table.log thead th:nth-child(4) {
    width: 14%;
  }
}

/* «Раньше»: the earlier days behind a summary. */
details.log-earlier > summary {
  color: var(--blu);
  font-weight: 500;
}

/* «Раньше» and «Ошибка» of a job are tap targets of 44px at least. */
details.log-earlier > summary,
table.log-analysis details[data-job-error] > summary,
table.log-images details > summary {
  min-height: 44px;
  padding-block: 11px;
}

/* On a phone the four columns of a day fit 390px: smaller type, the title, the score
   and the time wrap, the status tag stays on one line. */
@media (max-width: 575.98px) {
  nav.log-tabs {
    margin-bottom: -16px;
  }

  nav.log-tabs a {
    padding-inline: 8px;
    font-size: 14px;
  }

  /* Five tabs (#1107) are wider than 390px: the row scrolls sideways in place, the
     page does not. */
  nav.log-tabs ul {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .activity {
    padding: 16px;
  }

  .activity-grid {
    --cell: 10px;
    --gap: 2px;
  }

  .log-day .log-day-head {
    padding: 8px 12px;
  }

  table.log {
    font-size: 0.8125rem;
  }

  table.log th[scope="row"] {
    min-width: 0;
  }

  table.log td {
    white-space: normal;
  }

  /* A long status tag («прервана на 7 из 10») takes room: the time wraps instead. */
  .log-day table.log :is(th, td) {
    padding: 8px;
  }

  .log-day table.log td[data-session-status] .tag {
    padding-inline: 6px;
    font-size: 0.75rem;
  }
}

/* The tables of the analyses and of the model (#207): more columns than a phone holds,
   so the cells stay on one line, on a phone too, and the table scrolls sideways inside
   its .table-frame, not the page. The row of an error wraps instead. */
table.log-analysis td,
table.log-analysis th,
table.log-llm td,
table.log-llm th {
  white-space: nowrap;
}

table.log-analysis tr[data-job-error-row] td {
  white-space: normal;
}

table.log-analysis tr[data-job-error-row] details {
  margin-bottom: 0;
}

/* The pictures (#1107): the table of the analyses; the rows of an error and of the
   files of a run wrap, a file name breaks anywhere rather than widen the frame. */
table.log-images td,
table.log-images th {
  white-space: nowrap;
}

table.log-images tr:is([data-images-error-row], [data-images-files-row]) td {
  white-space: normal;
}

table.log-images tr:is([data-images-error-row], [data-images-files-row]) details {
  margin-bottom: 0;
}

table.log-images td[data-images-outcome="failed"] {
  color: var(--org);
}

.images-files {
  margin: 0;
  padding-inline-start: 0;
  color: var(--mut);
  font-family: var(--pico-font-family-monospace);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.images-files li {
  list-style: none;
}

table.log-analysis td[data-stage-status="failed"] {
  color: var(--org);
}

.analysis-error {
  color: var(--orgi);
  overflow-wrap: anywhere;
}

/* The model: a period is a group of rows, its forecast muted under its total; a group
   of a breakdown opens with the title of its period on --sf2. */
table.log-llm tbody + tbody > tr:first-child > :is(th, td) {
  border-top: 1px solid var(--ln);
}

table.log-llm tr.log-forecast > :is(th, td) {
  color: var(--mut);
  font-size: 0.8125rem;
}

/* The budget of the API (#391): its cell spans the columns of the tokens, wider than a
   phone, and starts after the wide column of the periods. The sum and the forecast are
   one phrase (#424) that wraps between words only, never inside a number with its
   unit; on a phone it wraps in a block as wide as the part of the cell in view, so it
   reads without scrolling sideways. */
table.log-llm tr[data-api-budget] > td {
  white-space: normal;
}

/* The batches of the month (v17): one phrase in the same cell, wrapping like the budget. */
table.log-llm tr[data-llm-batches] > td {
  white-space: normal;
}

/* In the budget and in the lists of the breakdowns alike. */
.llm-num {
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  [data-llm-periods] table.log-llm th[scope="row"] {
    white-space: normal;
  }

  [data-llm-periods] table.log-llm th[scope="row"] > small {
    display: block;
  }

  table.log-llm .llm-budget {
    display: block;
    max-width: 12rem;
  }

  table.log-llm .llm-batches {
    display: block;
    max-width: 12rem;
  }
}

table.log-llm th.log-group {
  background-color: var(--sf2);
  font-weight: 600;
}

table.log-llm small.log-kind {
  font-weight: normal;
}

/* Thirteen columns of the calls fit 1280px: tighter cells than Pico's. */
table.log-llm :is(th, td) {
  padding-inline: 0.625rem;
}

[data-llm-calls-scroll] table.log-llm {
  font-size: 0.8125rem;
}

[data-llm-calls-scroll] table.log-llm :is(th, td) {
  padding-inline: 0.5rem;
}

/* Up to 600px (#424): the calls keep the moment, the kind, the models and the cost;
   the other columns hide and the last cell opens them under its status. The moment,
   the kind and the models wrap there, the models between them only. The breakdowns turn
   into lists, a line per item. Above 600px the table is as before, all its columns. */
table.log-llm .llm-narrow,
.llm-list {
  display: none;
}

.llm-list section + section {
  margin-top: 12px;
}

.llm-list h3.llm-list-title {
  margin-bottom: 4px;
  font-size: 0.875rem;
  font-weight: 600;
}

.llm-list ul {
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}

.llm-list li {
  list-style: none;
  margin-bottom: 4px;
}

table.log-llm td[data-more] details {
  margin: 0;
}

table.log-llm td[data-more] summary {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  margin-block: -8px;
  padding-block: 0;
}

/* The status of a narrow row with its chevron fits the last column of 390px. */
table.log-llm td[data-more] summary::after {
  margin-inline-start: 0;
}

table.log-llm td[data-more] .tag {
  padding-inline: 6px;
  font-size: 0.75rem;
}

table.log-llm ul.llm-facts {
  margin: 0 0 8px;
  padding: 0;
}

table.log-llm ul.llm-facts li {
  list-style: none;
  margin: 0;
  color: var(--mut);
  white-space: normal;
}

@media (max-width: 600px) {
  table.log-llm .llm-wide,
  [data-llm-by] {
    display: none;
  }

  table.log-llm :is(th, td).llm-narrow {
    display: table-cell;
  }

  .llm-list {
    display: block;
    margin-bottom: var(--pico-spacing);
  }

  [data-llm-calls-scroll] table.log-llm {
    font-size: 0.75rem;
  }

  [data-llm-calls-scroll] table.log-llm :is(th, td) {
    padding-inline: 0.375rem;
  }

  [data-llm-calls-scroll] table.log-llm :is([data-call-when], [data-call-type]) {
    white-space: normal;
  }

  [data-llm-calls-scroll] table.log-llm [data-call-models] {
    white-space: normal;
  }
}

/* The models of a call wrap between models only, after the comma, never inside an ID at
   its hyphens (#527): «claude-sonnet-5-5» is one word; a narrow row is wider than 390px
   then and scrolls in its frame. */
table.log-llm .llm-model {
  white-space: nowrap;
}

/* ElevenLabs (#432): the balance of the credits over the table, the kinds of calls of
   a period under its total, indented and in the size of its forecast. */
.stt-balance {
  font-weight: 600;
}

.stt-balance[data-balance-error] {
  color: var(--mut);
  font-weight: normal;
}

table.log-stt tr.stt-kind > :is(th, td) {
  font-size: 0.8125rem;
}

table.log-stt tr.stt-kind > th {
  padding-inline-start: 1.5rem;
  font-weight: normal;
}

h2.log-heading {
  margin-top: calc(var(--pico-spacing) * 1.5);
  font-size: 1.125rem;
  font-weight: 600;
}

/* The share of a group in the spending of the month (#289): a bar of --blu on --trk
   whose width is --share (0 to 1, set inline), the percent next to it. */
.share-bar {
  display: inline-block;
  width: 72px;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--trk);
  vertical-align: middle;
}

.share-bar > i {
  display: block;
  width: calc(var(--share) * 100%);
  height: 100%;
  background: var(--blu);
}

/* The link in the line of an empty journal («Уроки», «Слова», #2127): a target of a
   finger on a phone (section 2.1, rule 4); the negative margins keep the line as high
   as its neighbours. */
@media (max-width: 575.98px) {
  .log-empty a {
    display: inline-block;
    min-height: 44px;
    margin-block: -11px;
    line-height: 44px;
  }
}

/* === settings === */

/* The settings page (#290, section 11): cards «Мягкий режим», «Тема», «Параметры»,
   then «Сохранить» 50px, the statistics reset in a card of its own; the confirmation
   page of the reset looks the same. One column, as wide as reads well; from 900px it
   stands in the middle of the container, equal fields on both sides (#325). */
.settings {
  max-width: 720px;
}

@media (min-width: 900px) {
  .settings {
    margin-inline: auto;
  }
}

.settings-card {
  margin-bottom: var(--pico-spacing);
  padding: 1rem 1.25rem;
}

.settings-card > fieldset,
.settings-card > :last-child,
.settings-card > fieldset > :last-child {
  margin-bottom: 0;
}

.settings-card legend,
.settings-card > h2 {
  margin-bottom: 0.75rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.settings-card small {
  display: block;
  color: var(--mut);
}

/* Messages above the form: the error comes from .form-error of the base region; the
   success «Настройки сохранены.» and the done reset on --blus. */
.settings .form-error {
  margin-bottom: var(--pico-spacing);
}

.settings-ok {
  margin-bottom: var(--pico-spacing);
  padding: 0.5rem 0.75rem;
  border-radius: var(--pico-border-radius);
  background: var(--blus);
  color: var(--blu);
}

/* The soft mode: the caption on the left, the switch 46x28 on the right, the
   explanation under them. The row is the label, at least 44px high. */
label.settings-switch {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 44px;
  margin-bottom: 0.25rem;
  cursor: pointer;
}

.settings-switch [type="checkbox"][role="switch"] {
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 14px;
}

/* The thumb: the inner height is 28 less two borders of 3px, so it travels 46 - 6 - 22. */
.settings-switch [type="checkbox"][role="switch"]:checked::before {
  margin-inline-start: 18px;
}

/* The theme and the dictation on a phone: three radios as one segmented control on
   --bg, apart from --sf in both themes; the chosen segment on --sf with a shadow.
   The radios are hidden, their labels are the segments. Not --trk since #1194: the
   darker track left the --mut labels under 4.5:1, --bg keeps them above it. */
.segmented {
  display: flex;
  gap: 4px;
  margin-bottom: 0.5rem;
  padding: 4px;
  border: 1px solid var(--ln);
  border-radius: var(--pico-border-radius);
  background: var(--bg);
}

.segmented > label {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding: 0 0.5rem;
  border-radius: 4px;
  color: var(--mut);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}

.segmented > label:has(input:checked) {
  background: var(--sf);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 18%, transparent);
  color: var(--ink);
  font-weight: 600;
}

/* Focus from the keyboard as on a field: a --blu border and a 3px ring of --fcs. */
.segmented > label:has(input:focus-visible) {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--blu), 0 0 0 3px var(--fcs);
}

.segmented [type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
}

/* The parameters: one row each, the label with the explanation and the bounds on the
   left, the field 72x44 on the right; the error of the refused one under its label. */
.param-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.75rem;
  border-top: 1px solid var(--ln2);
}

.param-row:first-of-type {
  padding-top: 0;
  border-top: 0;
}

.param-row:last-of-type {
  padding-bottom: 0;
}

.param-text {
  min-width: 0;
}

.param-text > label {
  margin-bottom: 0.125rem;
  font-weight: 500;
}

.param-bounds {
  white-space: nowrap;
}

.settings-card small.param-error {
  margin-bottom: 0.125rem;
  color: var(--orgi);
  font-weight: 500;
}

.param-row > input[type="number"],
.param-row > input[type="text"] {
  flex: none;
  width: 72px;
  height: 44px;
  margin: 0;
  padding: 0 0.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}

/* No spin buttons in a field of 72px; Pico pads a refused field for an icon it does
   not draw here (--pico-icon-invalid is none), with !important, so this one too. */
.param-row > input[type="number"]::-webkit-inner-spin-button,
.param-row > input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.param-row > input[type="number"][aria-invalid],
.param-row > input[type="text"][aria-invalid] {
  padding-right: 0.5rem !important;
  padding-left: 0.5rem !important;
  padding-inline: 0.5rem !important;
}

.settings-save {
  width: 100%;
  min-height: 50px;
  margin-bottom: calc(var(--pico-spacing) * 1.5);
  font-weight: 600;
}

/* The statistics reset: a card with an --orgl frame, an orange outline button. The
   confirmation page: the same card, its button filled orange. */
.settings-danger {
  border-color: var(--orgl);
}

.settings .btn-danger {
  --pico-background-color: var(--org);
  --pico-border-color: var(--org);
  --pico-color: var(--sf);
  min-height: 44px;
}

/* As specific as the outline button of the base region, which paints its border --btn. */
.settings .btn-danger.outline {
  --pico-background-color: transparent;
  --pico-border-color: var(--org);
  --pico-color: var(--orgi);
}

.settings .btn-danger:is(:hover, :active, :focus) {
  --pico-background-color: var(--orgi);
  --pico-border-color: var(--orgi);
}

/* The hover of the base outline button weighs (0,5,0); this one as much, and later. */
.settings :is(button, [type="submit"], [type="button"], [role="button"]).btn-danger.outline:is(:hover, :active, :focus) {
  --pico-background-color: var(--orgs);
  --pico-border-color: var(--org);
  --pico-color: var(--orgi);
}

.settings-danger-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.settings-danger-actions > form {
  margin: 0;
}

.settings-danger-actions :is(button, [role="button"]) {
  min-height: 44px;
  margin: 0;
}

/* «Открытый уровень» (v40, #1479; sketch 107 А): a step over one level muted and
   disabled, the note under the help, the confirmation of giving the level back in
   place of the note. */
.segmented > label.is-disabled {
  color: var(--fnt);
  cursor: not-allowed;
  opacity: 0.6;
}

.settings-card small.level-note {
  margin-top: 0.375rem;
}

.level-confirm {
  margin-top: 0.5rem;
  padding: 12px 14px;
  border: 1px solid var(--orgl);
  border-radius: var(--pico-border-radius);
  background: var(--orgs);
  color: var(--ink);
}

.level-confirm p {
  margin-bottom: 0.5rem;
  font-size: 0.9375rem;
}

.level-confirm-question {
  font-weight: 600;
}

.level-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.level-confirm-actions :is(button, [role="button"]) {
  width: auto;
  min-height: 44px;
  margin: 0;
}

/* «Строгость повторения» (section 11, v42, #1590): the segmented switch of the theme,
   the caption of the chosen value under it, then «Подробно» with the two fields of the
   pair in the rows of the parameters. */
.settings-card .strictness-more {
  margin: 0.75rem 0 0;
  padding-top: 0.25rem;
  border-top: 1px solid var(--ln2);
}

.settings-card .strictness-more > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 0;
  color: var(--blu);
  font-weight: 500;
}

.settings-card .strictness-more[open] > summary {
  margin-bottom: 0.5rem;
}

/* «Вход» (#1924): the address logged in from this browser and «Выйти». */
.settings-account p {
  margin-bottom: 0.75rem;
}

.settings-account form {
  margin: 0;
}

.settings-account button {
  width: auto;
  min-height: 44px;
  margin: 0;
}

/* === login === */

/* The layout «Полоса и карточка» of the pages of the first contact (#2035, decision of
   2026-11-25 «Экраны входа: В2»; login_layout.html): the login (docs/multiuser.md 10.5,
   #1924), the invitation by a link (10.15, #1971) and the consent (10.9, #1930). */

/* The first row is as high as the row of the sections on the other pages, 52px on a
   laptop and 44px on a phone (--site-bar of the header region), and keeps «EXTRA·CLASE»
   on a phone too: these pages have no sections to give way to. */
.login-top .site-bar {
  min-height: var(--site-bar);
}

.login-top .site-bar .brand {
  display: inline;
}

/* The band: the mark, the title and its caption in the middle; its lower part is the
   room the top edge of the card lies over (--login-overlap). The line between the rows
   is the top edge of the band, as of the title on the other pages. */
:root {
  --login-overlap: 40px;
}

.login-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: 24px calc(var(--login-overlap) + 28px);
  border-top: 1px solid var(--hdl);
  text-align: center;
}

.login-mark {
  display: block;
  margin-bottom: 12px;
}

.login-mark-tile {
  fill: var(--hdl);
}

.login-mark-letter {
  fill: var(--hdi);
}

.login-mark-tilde {
  fill: none;
  stroke: var(--och);
  stroke-width: 7;
  stroke-linecap: round;
}

/* The card of 440px in the middle, from the phone up (640px for the consent); its top
   edge lies over the band by --login-overlap. */
body > main:has(> .login) {
  padding-top: 0;
}

.login {
  position: relative;
  max-width: 440px;
  margin: calc(-1 * var(--login-overlap)) auto calc(var(--pico-spacing) * 2);
}

.login.terms {
  max-width: 640px;
}

.login-card {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: var(--sf);
}

@media (max-width: 575.98px) {
  .login-card {
    padding: 20px 16px;
  }
}

.login-card p,
.login-card form {
  margin-bottom: 0;
}

.login-card > * + * {
  margin-top: 16px;
}

/* The steps «1 Почта — 2 Код» above the form: the current one in ochre (the token of
   the current step, section 2.1), the other muted; a line between them. */
.login-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.login-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--mut);
  font-size: 0.875rem;
  list-style: none;
}

.login-steps li + li::before {
  content: "";
  width: 32px;
  height: 1px;
  margin-inline-end: 2px;
  background: var(--ln);
}

.login-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--ln);
  border-radius: 50%;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.login-steps li[aria-current="step"] {
  color: var(--ink);
  font-weight: 600;
}

.login-steps li[aria-current="step"] .login-step-number {
  border-color: var(--och);
  background: var(--ochs);
  color: var(--ochi);
}

/* The fields and the main buttons are 48px high. */
.login-card input:not([type="hidden"]) {
  height: 48px;
  margin-bottom: 8px;
}

.login-card small {
  display: block;
  margin-bottom: 16px;
  color: var(--mut);
}

.login-card button[type="submit"],
.login-card [role="button"] {
  width: 100%;
  min-height: 48px;
  margin-bottom: 0;
}

/* The code: a large field with the digits spaced out. */
.login-card input.login-code {
  height: 56px;
  font-size: 1.625rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.35em;
  text-align: center;
}

/* The line about the sent code lies in a blue block; a refusal in an orange block right
   above the field, the field itself framed in orange (Pico's aria-invalid, here by the
   token outright). Both carry their text, not a colour alone. */
.login-sent {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--blu) 30%, transparent);
  border-radius: var(--pico-border-radius);
  background: var(--blus);
  color: var(--blu);
}

.login-card .form-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--orgl);
  border-radius: var(--pico-border-radius);
  background: var(--orgs);
  color: var(--orgi);
}

.login-card input[aria-invalid="true"] {
  border-color: var(--org);
}

/* The address with «Другая почта» beside it. */
.login-address {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 12px;
  margin-bottom: 12px;
}

.login-address p {
  min-width: 0;
  color: var(--mut);
  overflow-wrap: anywhere;
}

.login-address strong {
  color: var(--ink);
}

.login-address a,
.login-more a,
.invite-more a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--blu);
}

/* «Отправить код ещё раз» at the bottom of the card, under a line. */
.login-more {
  padding-top: 16px;
  border-top: 1px solid var(--ln2);
}

.login-more button[type="submit"] {
  min-height: 44px;
}

/* The consent: the points numbered in ochre circles, «Принимаю» and «Выйти» in one
   row. The list stays the ul of the points, the numbers are its counter. */
.terms-points {
  margin: 0;
  padding: 0;
  counter-reset: terms;
}

.terms-points li {
  position: relative;
  margin-bottom: 14px;
  padding-inline-start: 40px;
  list-style: none;
  counter-increment: terms;
}

.terms-points li::before {
  content: counter(terms);
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--och);
  border-radius: 50%;
  background: var(--ochs);
  color: var(--ochi);
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.terms-actions {
  display: flex;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--ln2);
}

.terms-actions form {
  flex: 1;
  margin: 0;
}

/* The invitation: the greeting above the address, under the form a link to the login
   of one who has an account; the page «Вы вошли» with the app for iPhone as the
   button. */
.invite-greeting strong {
  color: var(--ink);
}

/* === admin === */

/* The shell of the section of the admin (docs/multiuser.md 10.22, sketch А2 of section
   185, #2039): its own header in the band of --hd with a line of ochre of 4px on top
   (on the bar, under the safe area of the iPhone), «EXTRA·CLASE», the mark «АДМИНКА»,
   on the right a lock with the host the page was opened by and «На сайт ↗». */
.admin-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
  padding: 0 24px;
  border-top: 4px solid var(--och);
}

.admin-bar .admin-brand {
  color: var(--hdi);
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.admin-bar .brand-dot {
  color: var(--och);
}

/* The mark of ochre: the dark text of the header on it, in both themes. */
.admin-mark {
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--och);
  color: var(--hd);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.admin-host {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-left: auto;
  color: var(--hdk);
  font-size: 13px;
  white-space: nowrap;
}

.admin-host svg {
  flex: none;
}

.admin-host-full {
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-host-short {
  display: none;
}

.admin-to-site {
  color: var(--hdi);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}

.admin-to-site:hover {
  color: var(--hdi);
  text-decoration: underline;
}

/* The side menu of 232px by groups (version 3 of the sketch), the page beside it. */
.admin-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: calc(100dvh - 56px);
}

/* A nav of Pico is a flex row: the menu is a column of groups. */
.admin-menu {
  display: block;
  padding: 18px 12px;
  border-right: 1px solid var(--ln);
  background: var(--sf);
  font-size: 14.5px;
}

.admin-menu-group {
  margin: 16px 10px 6px;
  color: var(--fnt);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-menu-group:first-child {
  margin-top: 0;
}

/* Pico lays the lists of a nav in a row and pulls its first and last list out by
   negative margins: here they are columns in the padding of the menu. */
.admin-menu ul:first-of-type,
.admin-menu ul:last-of-type,
.admin-chips ul:first-of-type {
  margin: 0;
}

.admin-menu ul,
.admin-chips ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-menu ul {
  display: block;
}

.admin-menu li,
.admin-chips li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.admin-menu li {
  display: block;
}

.admin-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}

.admin-menu a:hover {
  background: var(--sf2);
  color: var(--ink);
}

.admin-menu a[aria-current="page"] {
  background: var(--ochs);
  box-shadow: inset 3px 0 0 var(--och);
  font-weight: 600;
}

.admin-count {
  padding: 0 7px;
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: var(--sf2);
  color: var(--mut);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.admin-ext {
  color: var(--fnt);
  font-size: 12px;
}

/* The row of chips takes the place of the menu on a phone, with the second row of the
   items of «Журналы» or «Очередь» on a page of the group (#2127). */
.admin-chips,
.admin-subchips {
  display: none;
}

.admin-main {
  min-width: 0;
  padding: 22px 28px 40px;
}

.admin-head {
  margin: 0 0 16px;
}

.admin-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

/* The density of the service pages: rows of tables of about 36px, the text 13.5px. */
.admin-main table {
  font-size: 13.5px;
}

.admin-main .table-frame :is(th, td) {
  padding-block: 8px;
}

.admin-pending {
  color: var(--mut);
}

.admin-pending p {
  margin: 0;
}

@media (max-width: 575.98px) {
  .admin-bar {
    gap: 10px;
    padding: 0 16px;
  }

  .admin-bar .admin-brand,
  .admin-host-full {
    display: none;
  }

  .admin-host-short {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* A target of a finger, as the chips (section 2.1, rule 4). */
  .admin-to-site {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .admin-chips {
    display: block;
    border-bottom: 1px solid var(--ln);
    background: var(--sf);
  }

  /* One row that scrolls sideways in itself, never the page. */
  .admin-chips ul {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .admin-chips a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--ln);
    border-radius: 22px;
    color: var(--ink);
    font-size: 13.5px;
    text-decoration: none;
    white-space: nowrap;
  }

  .admin-chips a[aria-current="page"] {
    border-color: var(--och);
    background: var(--ochs);
    font-weight: 600;
  }

  /* The second row (#2127): the items of the group of the page, quieter than the chips
     of the sections, the current one on --sf with a frame; 44px for a finger. */
  .admin-subchips {
    display: block;
    border-bottom: 1px solid var(--ln);
    background: var(--sf2);
  }

  .admin-subchips ul,
  .admin-subchips ul:first-of-type {
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 4px 12px;
    overflow-x: auto;
    list-style: none;
    scrollbar-width: none;
  }

  .admin-subchips li {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .admin-subchips a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 22px;
    color: var(--mut);
    font-size: 13.5px;
    text-decoration: none;
    white-space: nowrap;
  }

  .admin-subchips a[aria-current="page"] {
    border-color: var(--ln);
    background: var(--sf);
    color: var(--ink);
    font-weight: 600;
  }

  .admin-shell {
    display: block;
    min-height: 0;
  }

  .admin-menu {
    display: none;
  }

  .admin-main {
    padding: 16px 16px 32px;
  }
}

/* «Приглашения» (docs/multiuser.md 10.22, item 11; section 187, #2043): the form of a
   new link in a box of 360px on the left, the list on the right; under the form the
   link just made on --ochs, its address and the text for a messenger on --sf. The
   states of a link are chips with the word: waiting blue, used ochre, run out and
   revoked grey, their rows dimmed. On a phone one column and the list as cards. */
.invites-caption {
  margin: 2px 0 0;
  color: var(--mut);
  font-size: 14px;
}

.invites {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.invites-new {
  padding: 18px;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
}

.invites-new h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.invites-new label {
  display: block;
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
}

.invites-new input:not([type="hidden"]) {
  height: 40px;
  margin: 0;
  padding: 0 12px;
  font-size: 14.5px;
}

.invites-help {
  margin: 6px 0 0;
  color: var(--mut);
  font-size: 13px;
}

/* A refused field says so in words, on the orange of a wrong answer. */
.invites-help.invites-field-error {
  color: var(--orgi);
}

.invites-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.invites-new .invites-create {
  width: 100%;
  min-height: 42px;
  margin: 16px 0 0;
  font-weight: 600;
}

.invites-link {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--ochs);
  color: var(--ink);
  font-size: 13px;
}

.invites-link p {
  margin: 8px 0 0;
}

.invites-link .invites-link-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.invites-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 6px 6px 6px 10px;
  border: 1px solid var(--ln);
  border-radius: 6px;
  background: var(--sf);
}

.invites-copy span {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}

/* As specific as the secondary button of the base region, which is 40px high. Both
   buttons stand on --sf, as the address and the text do: on --ochs of the dark theme a
   transparent one all but vanishes. */
.invites-link button.secondary {
  flex: none;
  min-height: 32px;
  margin: 0;
  padding: 4px 12px;
  background-color: var(--sf);
  font-size: 13.5px;
}

.invites-link > button.secondary {
  margin-top: 8px;
}

/* The text keeps the lines of its template and is seen whole, its height by it. */
.invites-message {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--ln);
  border-radius: 6px;
  background: var(--sf);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* Pico draws a [role=group] as a group of buttons the full width: here a segment. */
.invites-filter {
  display: inline-flex;
  width: auto;
  margin: 0 0 12px;
  box-shadow: none;
  overflow: hidden;
  border: 1px solid var(--ln);
  border-radius: 6px;
  font-size: 13.5px;
}

.invites-filter a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  background: var(--sf);
  color: var(--mut);
  text-decoration: none;
}

.invites-filter a + a {
  border-left: 1px solid var(--ln);
}

.invites-filter a:hover {
  color: var(--ink);
}

.invites-filter a[aria-current="page"] {
  background: var(--btn);
  color: var(--btni);
  font-weight: 600;
}

.invites-table :is(th, td) {
  padding-inline: 8px;
  white-space: nowrap;
  vertical-align: middle;
}

/* The cell of «Отозвать» keeps the row at about 36px. */
.invites-table td:last-child {
  padding-block: 3px;
}

/* The name of a link (up to 80 signs) and the names of those who came wrap. */
.invites-table td:first-child,
.invites-table td[data-invite-joined] {
  min-width: 64px;
  white-space: normal;
}

.invites-table th {
  font-size: 12.5px;
}

.invites-table .invites-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.invites-table tr.invites-dim td {
  color: var(--fnt);
}

.invites-revoke {
  margin: 0;
}

.invites-revoke button.secondary {
  min-height: 30px;
  margin: 0;
  padding: 3px 10px;
  font-size: 13.5px;
}

.invite-state {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.invite-state-wait {
  background: var(--blus);
  color: var(--blu);
}

.invite-state-used {
  background: var(--ochs);
  color: var(--ochi);
}

.invite-state-gone {
  border: 1px solid var(--ln);
  background: var(--sf2);
  color: var(--mut);
}

.invites-cards {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.invites-card {
  margin: 0 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
  font-size: 14px;
  list-style: none;
}

.invites-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.invites-card-sub {
  margin: 2px 0 0;
  color: var(--mut);
  font-size: 13px;
}

.invites-card .invites-revoke {
  margin-top: 8px;
}

.invites-card .invites-revoke button.secondary {
  width: auto;
  min-height: 44px;
}

.invites-empty {
  margin: 0;
  color: var(--mut);
}

@media (max-width: 899.98px) {
  .invites {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 575.98px) {
  .invites-table {
    display: none;
  }

  .invites-cards {
    display: block;
  }

  .invites-new input:not([type="hidden"]),
  .invites-new .invites-create,
  .invites-link button.secondary,
  .invites-filter a {
    min-height: 44px;
  }

  .invites-new input:not([type="hidden"]) {
    height: 44px;
    font-size: 16px;
  }
}

/* «Пользователи» (docs/multiuser.md 10.22, item 10; section 186, #2041): the caption
   with «Пригласить ссылкой», the search and the segments of the filter, the table of
   rows of about 36px with the menu «···» of a row and the devices of a row under it. */
.admin-users-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin-top: 2px;
}

.admin-users-caption p {
  margin: 0;
  color: var(--mut);
  font-size: 14px;
}

.admin-users-caption .admin-users-invite {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin: 0;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* The message of an action at the top of the list; the new code of the login large. */
.admin-users-notice {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--blus);
  color: var(--ink);
  font-size: 14px;
}

.admin-users-notice.is-refused {
  background: var(--ochs);
}

.admin-users-notice p {
  margin: 0;
}

.admin-users-code {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
}

.admin-users-notice .admin-users-code-note {
  margin-top: 4px;
  color: var(--mut);
  font-size: 13px;
}

.admin-users-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
}

.admin-users-filter input[type="search"] {
  width: 240px;
  height: 36px;
  margin: 0;
  padding-block: 0;
  border-radius: 6px;
  font-size: 14px;
}

.admin-users-seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--ln);
  border-radius: 6px;
  font-size: 13.5px;
}

.admin-users-seg a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  background: var(--sf);
  color: var(--mut);
  text-decoration: none;
}

.admin-users-seg a + a {
  border-left: 1px solid var(--ln);
}

.admin-users-seg a:hover {
  color: var(--ink);
}

.admin-users-seg a[aria-current="true"] {
  background: var(--btn);
  color: var(--btni);
  font-weight: 600;
}

/* No overflow of its own: the menu of a row goes out of the frame. */
.admin-users-frame {
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
}

.admin-users-table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  font-size: 13.5px;
}

.admin-users-table > thead > tr > th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--ln);
  background: var(--sf2);
  color: var(--mut);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.admin-users-table > thead > tr > th:first-child {
  border-top-left-radius: 7px;
}

.admin-users-table > thead > tr > th:last-child {
  border-top-right-radius: 7px;
}

.admin-users-table > tbody > tr > td {
  padding: 9px 12px;
  border-top: 1px solid var(--ln2);
  border-bottom: 0;
  background: var(--sf);
  color: var(--ink);
  vertical-align: middle;
  white-space: nowrap;
}

.admin-users-table > tbody > tr:first-child > td {
  border-top: 0;
}

.admin-users-table > tbody > tr:last-child > td {
  border-bottom-right-radius: 7px;
  border-bottom-left-radius: 7px;
}

.admin-users-table > :is(thead, tbody) > tr > .num {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.admin-user-who b {
  display: block;
  font-weight: 600;
}

.admin-user-who em {
  color: var(--mut);
  font-size: 12.5px;
  font-style: normal;
}

.admin-users-table > tbody > tr.is-dim > td,
.admin-users-table > tbody > tr.is-dim .admin-user-who em {
  color: var(--fnt);
}

.admin-users-table > tbody > tr.is-sel > td {
  background: var(--blus);
}

/* The role and the state in a chip: the admin dark, a disabled one grey, the one being
   deleted orange; the word says it in every case. */
.admin-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-chip-admin {
  background: var(--ink);
  color: var(--bg);
}

.admin-chip-disabled {
  border: 1px solid var(--ln);
  background: var(--sf2);
  color: var(--mut);
}

.admin-chip-deleting {
  background: var(--orgs);
  color: var(--orgi);
}

/* The chips beside the name stand for the columns of the role and the state on a
   phone. */
.admin-users-phone {
  display: none;
}

.admin-users-table > tbody > tr > .admin-user-actions {
  width: 1%;
  text-align: right;
}

.admin-user-menu {
  position: relative;
  display: inline-block;
  margin: 0;
}

.admin-user-menu > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--ln);
  border-radius: 6px;
  color: var(--mut);
  font-weight: 700;
  letter-spacing: 1px;
  list-style: none;
  cursor: pointer;
}

.admin-user-menu > summary::-webkit-details-marker {
  display: none;
}

/* Pico draws its arrow after a summary and spaces an open one from its body. */
.admin-user-menu > summary::after {
  display: none;
}

.admin-user-menu[open] > summary {
  margin-bottom: 0;
}

.admin-user-menu[open] > summary:not(:focus) {
  color: var(--mut);
}

.admin-user-pop {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  width: 230px;
  padding: 6px;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
  box-shadow: 0 10px 26px color-mix(in oklab, var(--ink) 18%, transparent);
  font-size: 14px;
  text-align: left;
  white-space: normal;
}

/* Without room under the row (the last rows on a phone) app.js opens the menu upwards
   (#2127). */
.admin-user-menu.is-up .admin-user-pop {
  top: auto;
  bottom: calc(100% + 4px);
}

.admin-user-pop form {
  margin: 0;
}

.admin-user-pop :is(a, button) {
  --pico-background-color: transparent;
  --pico-border-color: transparent;
  --pico-color: var(--ink);
  --pico-box-shadow: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  text-decoration: none;
}

.admin-user-pop :is(a, button):not(:disabled):hover {
  background: var(--sf2);
  color: var(--ink);
}

.admin-user-pop small {
  display: block;
  padding: 0 10px 4px;
  color: var(--fnt);
  font-size: 12px;
}

.admin-user-pop hr {
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--ln2);
}

/* «Устройства и токены» under the row. */
.admin-users-table > tbody > tr.admin-user-drawer > td {
  padding: 14px 16px;
  border-top: 1px solid var(--ln);
  background: var(--sf2);
  white-space: normal;
}

.admin-drawer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.admin-drawer-head form {
  margin: 0;
}

.admin-users-table .admin-btn2 {
  --pico-background-color: var(--sf);
  --pico-border-color: var(--ln);
  --pico-color: var(--ink);
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--ln);
  border-radius: 6px;
  background: var(--sf);
  color: var(--ink);
  font-size: 13.5px;
  white-space: nowrap;
  width: auto;
}

.admin-users-table .admin-btn2:hover {
  --pico-background-color: var(--sf2);
  --pico-border-color: var(--mut);
  --pico-color: var(--ink);
}

/* Positioned: the hidden label of its last column scrolls with it, not out of it.
   Width 0 with min-width 100%: the frame takes the width of the row and gives none of
   its content to the table of the users, so a long label never widens the page. */
.admin-drawer-frame {
  position: relative;
  width: 0;
  min-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
}

.admin-drawer-frame table {
  width: 100%;
  margin: 0;
  font-size: 13.5px;
}

.admin-drawer-frame :is(th, td) {
  padding: 7px 12px;
  border-bottom: 1px solid var(--ln2);
  background: var(--sf);
  color: var(--ink);
  white-space: nowrap;
}

.admin-drawer-frame th {
  background: var(--sf2);
  color: var(--mut);
  font-size: 12.5px;
  font-weight: 600;
}

.admin-drawer-frame tbody tr:last-child > td {
  border-bottom: 0;
}

.admin-drawer-frame td:last-child {
  text-align: right;
}

/* The device wraps: «Mac · Safari», an older label of a raw header. */
.admin-drawer-frame .admin-token-device {
  min-width: 8rem;
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-drawer-none {
  margin: 0;
  color: var(--mut);
  font-size: 13.5px;
}

/* Narrower than the table: each row is a card, «пришёл 1 сен · занимался сегодня ·
   устройств 3» under the name and the address, the chips of the role and the state
   beside the name. */
@media (max-width: 1023.98px) {
  .admin-users-frame {
    border: 0;
    background: transparent;
  }

  .admin-users-table > thead {
    display: none;
  }

  .admin-users-table,
  .admin-users-table > tbody {
    display: block;
  }

  .admin-users-table > tbody > tr {
    display: block;
    margin: 0 0 8px;
    border: 1px solid var(--ln);
    border-radius: 8px;
    background: var(--sf);
  }

  .admin-users-table > tbody > tr.admin-user-row {
    position: relative;
    padding: 12px 54px 12px 14px;
  }

  .admin-users-table > tbody > tr > td,
  .admin-users-table > tbody > tr:first-child > td {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .admin-users-table > tbody > tr:last-child > td {
    border-radius: 0;
  }

  .admin-users-table > tbody > tr.is-sel {
    border-color: var(--blu);
    background: var(--blus);
  }

  .admin-users-table > tbody > tr.admin-user-row > td {
    display: none;
  }

  .admin-users-table > tbody > tr.admin-user-row > .admin-user-who {
    display: block;
    font-size: 14px;
    white-space: normal;
  }

  .admin-user-who em {
    display: block;
    margin-top: 2px;
    font-size: 13px;
  }

  .admin-users-phone {
    display: inline-block;
    margin-left: 4px;
    vertical-align: 1px;
  }

  /* A part of «пришёл 1 сен · занимался сегодня · устройств 3» keeps its words on one
     line, the dot stays at the end of the line before a break (#2127). */
  .admin-users-table > tbody > tr.admin-user-row > .admin-user-meta {
    display: inline;
    color: var(--mut);
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
  }

  .admin-users-table > tbody > tr.admin-user-row > .admin-user-meta::before {
    content: attr(data-label) " ";
  }

  .admin-users-table > tbody > tr.admin-user-row > .admin-user-meta:has(~ .admin-user-meta)::after {
    content: "\00a0·";
  }

  .admin-users-table > tbody > tr.admin-user-row > .admin-user-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: block;
    width: auto;
  }

  .admin-user-menu > summary {
    width: 44px;
    height: 44px;
  }

  .admin-users-table > tbody > tr.admin-user-drawer > td {
    display: block;
    padding: 12px 14px;
    border-radius: 8px;
  }

  .admin-users-table > tbody > tr.admin-users-none > td {
    display: block;
    padding: 12px 14px;
  }
}

/* On a phone the caption and the button are short, the search takes its own line and
   the targets are 44px. */
@media (max-width: 575.98px) {
  .admin-users-wide {
    display: none;
  }

  .admin-users-filter input[type="search"] {
    flex: 1 1 100%;
    width: 100%;
    height: 44px;
  }

  .admin-users-seg a {
    min-height: 44px;
  }

  .admin-users-caption .admin-users-invite {
    min-height: 44px;
  }

  .admin-user-pop :is(a, button) {
    min-height: 44px;
  }

  .admin-users-table .admin-btn2 {
    min-height: 44px;
  }

  /* The tokens as cards: the device, then «ios · выдан 26 ноя · использован сегодня
     · до 24 фев 2027», «Отозвать» across the card under it, all in sight. */
  .admin-drawer-frame {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .admin-drawer-frame :is(table, tbody, tr, td) {
    display: block;
  }

  .admin-drawer-frame thead {
    display: none;
  }

  .admin-drawer-frame tbody tr {
    margin: 0 0 8px;
    padding: 10px 12px;
    border: 1px solid var(--ln);
    border-radius: 8px;
    background: var(--sf);
  }

  .admin-drawer-frame :is(th, td),
  .admin-drawer-frame tbody tr:last-child > td {
    padding: 0;
    border: 0;
    background: transparent;
    white-space: normal;
  }

  .admin-drawer-frame .admin-token-device {
    min-width: 0;
    font-weight: 600;
  }

  .admin-drawer-frame :is(.admin-token-kind, .admin-token-meta) {
    display: inline;
    color: var(--mut);
    font-size: 13px;
  }

  .admin-drawer-frame .admin-token-meta::before {
    content: " · " attr(data-label) " ";
  }

  .admin-drawer-frame td.admin-token-revoke {
    margin-top: 8px;
    text-align: left;
  }

  .admin-drawer-frame .admin-token-revoke .admin-btn2 {
    justify-content: center;
    width: 100%;
  }
}

/* «Удалить аккаунт…» of a row (#2042, section 186): the item orange, said by its word;
   a deletion that stopped short says why under the state. */
.admin-user-pop .admin-user-danger,
.admin-user-pop .admin-user-danger:not(:disabled):hover {
  --pico-color: var(--orgi);
  color: var(--orgi);
}

.admin-user-unfinished {
  display: block;
  max-width: 16rem;
  margin-top: 2px;
  color: var(--orgi);
  font-size: 12px;
  white-space: normal;
}

/* The window of the deletion over the list: a shade over the page, the card of 480px
   in the middle with the consequences, the field of the address and «Отмена» beside
   «Удалить навсегда» on --org. */
.admin-delete-ovl {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: color-mix(in oklab, var(--hd) 55%, transparent);
}

.admin-delete {
  width: 480px;
  max-width: 100%;
  margin: auto;
  padding: 22px;
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: var(--sf);
  box-shadow: 0 16px 40px color-mix(in oklab, var(--ink) 22%, transparent);
  color: var(--ink);
}

.admin-delete h2 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
}

.admin-delete ul {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 14px;
}

.admin-delete li {
  margin: 3px 0;
  list-style: disc;
}

.admin-delete-error {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--orgs);
  color: var(--orgi);
  font-size: 13.5px;
}

.admin-delete form {
  margin: 0;
}

.admin-delete label {
  display: block;
  margin: 0 0 4px;
  font-size: 13.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.admin-delete input[data-delete-email] {
  height: 40px;
  margin: 0;
  padding-block: 0;
  font-size: 14px;
}

.admin-delete-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.admin-delete-acts :is(a, button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-height: 40px;
  margin: 0;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-delete-acts .admin-delete-confirm {
  --pico-background-color: var(--org);
  --pico-border-color: var(--org);
  --pico-color: var(--sf);
}

.admin-delete-acts .admin-delete-confirm:not(:disabled):is(:hover, :active, :focus) {
  --pico-background-color: var(--orgi);
  --pico-border-color: var(--orgi);
  --pico-color: var(--sf);
}

/* On a phone the field and the buttons are 44px, the buttons share the width. */
@media (max-width: 575.98px) {
  .admin-delete {
    padding: 18px 16px;
  }

  .admin-delete input[data-delete-email] {
    height: 44px;
    font-size: 16px;
  }

  .admin-delete-acts :is(a, button) {
    flex: 1 1 0;
    min-height: 44px;
  }

  .admin-user-unfinished {
    max-width: none;
  }
}

/* «Учебный цикл» GET /admin/loop (docs/multiuser.md 10.22, item 13; section 192 of the
   sketch; #2051): the lead and the filter under the title, the table of the flows with
   the word of the balance in a chip (blue «ровно», ochre «копится», orange «не
   успевают»), the line of the new exercises, two boxes (the minutes a day by week
   against the dashed goal, retention by step) and the table of the users with its
   alarms; on a phone the flows are cards and the boxes one column. */
.admin-loop-lead {
  margin: 2px 0 0;
  color: var(--mut);
  font-size: 14px;
}

.admin-loop-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
}

.admin-loop-who {
  display: flex;
  gap: 8px;
  margin: 0;
}

.admin-loop-who select {
  width: 240px;
  height: 40px;
  margin: 0;
  padding-block: 0;
  font-size: 14px;
}

.admin-loop-who button {
  height: 40px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--ln);
  background: var(--sf);
  color: var(--ink);
  font-size: 14px;
}

.admin-loop-who button:hover {
  border-color: var(--mut);
  background: var(--sf2);
  color: var(--ink);
}

.admin-loop-weeks {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--ln);
  border-radius: 6px;
  font-size: 13.5px;
}

.admin-loop-weeks a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  background: var(--sf);
  color: var(--mut);
  text-decoration: none;
}

.admin-loop-weeks a + a {
  border-left: 1px solid var(--ln);
}

.admin-loop-weeks a[aria-current="page"] {
  background: var(--btn);
  color: var(--btni);
  font-weight: 600;
}

.admin-main :is(.admin-loop-flows, .admin-loop-users, .admin-loop-steps) :is(th, td).num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.admin-loop-flows,
.admin-loop-users {
  margin-bottom: 0;
}

.admin-loop-flows :is(th, td),
.admin-loop-users :is(th, td) {
  white-space: nowrap;
}

/* The long headings of the columns wrap: the numbers under them stay on one line. */
.admin-loop-users thead th {
  min-width: 84px;
  vertical-align: bottom;
  white-space: normal;
}

.admin-loop-flows tbody th,
.admin-loop-users tbody th {
  color: var(--ink);
  font-weight: 600;
}

.admin-loop-empty {
  color: var(--fnt);
  cursor: help;
}

/* The reason of a dash, seen without a pointer: two words under it in a table, the
   whole note beside it in a box. */
.admin-loop-why {
  display: block;
  color: var(--mut);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
  white-space: normal;
}

.admin-loop-why-inline {
  color: var(--mut);
  font-size: 13px;
}

/* An alarm of a cell: the number on ochre or orange, its word in the note and hidden
   text beside it. */
.admin-loop-cell[data-tone] {
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.admin-loop-cell[data-tone="accumulating"] {
  background: var(--ochs);
  color: var(--ochi);
}

.admin-loop-cell[data-tone="behind"] {
  background: var(--orgs);
  color: var(--orgi);
}

.admin-loop-balance {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-loop-balance[data-balance="even"] {
  background: var(--blus);
  color: var(--blu);
}

.admin-loop-balance[data-balance="accumulating"] {
  background: var(--ochs);
  color: var(--ochi);
}

.admin-loop-balance[data-balance="behind"] {
  background: var(--orgs);
  color: var(--orgi);
}

/* The flows as cards: a phone only. */
.admin-loop-cards {
  display: none;
}

.admin-loop-note {
  margin: 10px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--ln);
  border-radius: 6px;
  background: var(--sf);
  color: var(--ink);
  font-size: 13.5px;
}

.admin-loop-changed {
  color: var(--ochi);
  font-weight: 600;
}

.admin-loop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-top: 14px;
}

.admin-loop-box {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--ln);
  border-radius: 6px;
  background: var(--sf);
}

.admin-loop-box h2,
.admin-loop-sub {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.admin-loop-sub {
  margin: 20px 0 8px;
}

.admin-loop-help {
  margin: 0 0 10px;
  color: var(--mut);
  font-size: 13px;
}

.admin-loop-box > .admin-loop-help:last-child {
  margin: 10px 0 0;
}

/* The minutes a day of each week as bars, the goal a dashed line of ochre over them. */
.admin-loop-hist {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 90px;
  margin-top: 22px;
}

.admin-loop-hist i {
  flex: 1;
  height: calc(var(--h) * 100%);
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blu);
  opacity: 0.85;
}

.admin-loop-hist i.admin-loop-none {
  background: var(--ln2);
  opacity: 1;
}

.admin-loop-goal {
  position: absolute;
  right: 0;
  bottom: calc(var(--goal) * 100%);
  left: 0;
  border-top: 2px dashed var(--och);
  pointer-events: none;
}

.admin-loop-goal em {
  position: absolute;
  top: -18px;
  right: 0;
  color: var(--ochi);
  font-size: 11.5px;
  font-style: normal;
}

.admin-loop-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  color: var(--fnt);
  font-size: 11.5px;
}

.admin-loop-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 12px 0 0;
  font-size: 14px;
}

.admin-loop-kv dt {
  color: var(--mut);
  font-weight: 400;
}

.admin-loop-kv dd {
  margin: 0;
}

.admin-loop-kv small {
  color: var(--mut);
  font-size: 12.5px;
}

.admin-loop-steps {
  width: 100%;
  margin: 0;
  font-size: 13px;
}

.admin-loop-steps :is(th, td) {
  padding: 6px 8px;
  border-bottom: 1px solid var(--ln2);
  background: transparent;
  color: var(--ink);
  font-weight: 400;
  white-space: nowrap;
}

.admin-loop-steps tr:last-child > :is(th, td) {
  border-bottom: 0;
}

.admin-loop-bar {
  display: inline-block;
  width: 90px;
  height: 6px;
  margin-right: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--ln2);
  vertical-align: middle;
}

.admin-loop-bar i {
  display: block;
  width: calc(var(--share) * 100%);
  height: 100%;
  background: var(--blu);
}

.admin-loop-users tbody th a {
  color: var(--ink);
  text-decoration: none;
}

.admin-loop-users tbody th a:hover {
  text-decoration: underline;
}

.admin-loop-dim :is(th, td) {
  color: var(--fnt);
}

.admin-loop-settings {
  color: var(--mut);
}

.admin-loop-legend {
  margin: 8px 0 0;
  color: var(--mut);
  font-size: 13px;
}

@media (max-width: 575.98px) {
  .admin-loop-who {
    flex: 1 1 100%;
  }

  .admin-loop-who select {
    flex: 1;
    width: auto;
    height: 44px;
  }

  .admin-loop-who button,
  .admin-loop-weeks a {
    height: 44px;
    min-height: 44px;
  }

  /* The name that leads to the view of one user: a target of a finger (rule 4). */
  .admin-loop-users tbody th a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .admin-loop-flows {
    display: none;
  }

  .admin-loop-cards {
    display: block;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .admin-loop-cards li {
    margin: 0 0 8px;
    padding: 12px 14px;
    border: 1px solid var(--ln);
    border-radius: 6px;
    background: var(--sf);
    font-size: 14px;
    list-style: none;
  }

  .admin-loop-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .admin-loop-card-line {
    display: block;
    margin-top: 2px;
    color: var(--mut);
    font-size: 13px;
  }

  .admin-loop-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* «Состояние сервера» (GET /admin/server, section 191 of the sketch, #2049): the «!» of
   its item in the menu, the time of the checks with «Проверить сейчас», the banner, eight
   tiles in four columns (one on a phone) and the journal of events. A state is a word on
   a chip and a colour together: «в порядке» blue, «внимание» ochre, «сбой» orange, «нет
   данных» grey with a frame (section 2.1, rule 1). */
/* Positioned: its hidden words stay inside the row of chips, which scrolls in itself. */
.admin-alert {
  position: relative;
  border-color: var(--och);
  background: var(--ochs);
  color: var(--ochi);
}

.admin-server-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin: -8px 0 16px;
}

.admin-server-checked {
  margin: 0;
  color: var(--mut);
  font-size: 14px;
}

/* «Проверить сейчас»: a link to the page itself, drawn as a light button. */
.admin-server-recheck {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ln);
  border-radius: 6px;
  background: var(--sf);
  color: var(--ink);
  font-size: 13.5px;
  text-decoration: none;
  white-space: nowrap;
}

.admin-server-recheck:hover {
  border-color: var(--mut);
  background: var(--sf2);
  color: var(--ink);
}

.admin-server-banner {
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--blus);
  color: var(--ink);
  font-size: 14px;
}

.admin-server-banner[data-server-banner="warn"] {
  border-color: var(--och);
  background: var(--ochs);
}

.admin-server-banner[data-server-banner="fail"] {
  border-color: var(--orgl);
  background: var(--orgs);
}

.admin-server-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-server-tile {
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
  font-size: 13px;
}

.admin-server-tile[data-state="warn"] {
  border-color: var(--och);
}

.admin-server-tile[data-state="fail"] {
  border-color: var(--org);
}

.admin-server-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 6px;
}

.admin-server-tile h2 {
  margin: 0;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
}

.admin-server-state {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-server-state[data-state="ok"] {
  background: var(--blus);
  color: var(--blu);
}

.admin-server-state[data-state="warn"] {
  background: var(--ochs);
  color: var(--ochi);
}

.admin-server-state[data-state="fail"] {
  background: var(--orgs);
  color: var(--orgi);
}

.admin-server-state[data-state="none"],
.admin-server-state[data-state="gone"] {
  border-color: var(--ln);
  background: var(--sf2);
  color: var(--mut);
}

.admin-server-bar-track {
  height: 6px;
  margin: 4px 0 8px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--ln2);
}

.admin-server-bar-track i {
  display: block;
  height: 100%;
  background: var(--blu);
}

.admin-server-tile[data-state="warn"] .admin-server-bar-track i {
  background: var(--och);
}

.admin-server-tile[data-state="fail"] .admin-server-bar-track i {
  background: var(--org);
}

.admin-server-tile ul {
  margin: 0;
  padding: 0;
  color: var(--mut);
  list-style: none;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.admin-server-tile li {
  margin: 2px 0;
  list-style: none;
}

.admin-server-sub {
  margin: 20px 0 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.admin-server-empty {
  margin: 0;
  color: var(--mut);
}

.admin-server-journal td {
  white-space: nowrap;
}

/* The name of the column of the length, on a phone alone, where the head is hidden. */
.admin-server-label {
  display: none;
}

.admin-server-journal td:nth-child(2) {
  white-space: normal;
}

@media (max-width: 1023.98px) {
  .admin-server-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .admin-server-bar {
    margin-top: -4px;
  }

  .admin-server-recheck {
    min-height: 44px;
  }

  /* The journal as cards: the time and the state on the first line, the text under
     them, the length after it; nothing beyond the edge of the frame. */
  .admin-server-journal thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .admin-server-journal :is(table, tbody) {
    display: block;
    width: 100%;
  }

  .admin-server-journal tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 10px;
    padding: 10px 12px;
    border-top: 1px solid var(--ln2);
  }

  .admin-server-journal tr:first-child {
    border-top: 0;
  }

  .admin-server-journal :is(th, td) {
    padding: 0;
    border: 0;
    white-space: normal;
  }

  .admin-server-journal td.admin-server-when {
    grid-column: 1;
    grid-row: 1;
    color: var(--mut);
  }

  .admin-server-journal td.admin-server-closed {
    grid-column: 2;
    grid-row: 1;
  }

  .admin-server-journal td.admin-server-what {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .admin-server-journal td.admin-server-lasted {
    grid-column: 1 / -1;
    grid-row: 3;
    color: var(--mut);
  }

  .admin-server-label {
    display: inline;
  }

  .admin-server-tiles {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
}

/* «Статистика» (docs/multiuser.md 10.22, item 12; section 188 of the sketch; #2044):
   the caption with the switch of the period on the right, the chips of the groups, the
   cards of the summary, the table of the users (cards on a phone), the page of one
   user with the attempts by day and the summary. */
.admin-stats-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 20px;
}

.admin-caption {
  margin: 2px 0 0;
  color: var(--mut);
  font-size: 14px;
}

.admin-crumb {
  margin: 0 0 6px;
  font-size: 13.5px;
}

.admin-crumb a {
  color: var(--blu);
  text-decoration: none;
}

/* The switch of 7 and 30 days: two segments, the current one filled as the main button. */
.admin-period {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--ln);
  border-radius: 6px;
  font-size: 13.5px;
}

.admin-period a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  background: var(--sf);
  color: var(--mut);
  text-decoration: none;
  white-space: nowrap;
}

.admin-period a[aria-current="page"] {
  background: var(--btn);
  color: var(--btni);
  font-weight: 600;
}

/* A nav of Pico spreads its items by space-between: the chips stand side by side. */
.admin-cohorts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px;
  margin: 0 0 12px;
}

.admin-cohorts a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--ln);
  border-radius: 16px;
  background: var(--sf);
  color: var(--ink);
  font-size: 13.5px;
  text-decoration: none;
}

.admin-cohorts a[aria-current="page"] {
  border-color: var(--och);
  background: var(--ochs);
  font-weight: 600;
}

/* The cards of the summary: seven in a row on a laptop, four on the page of one user. */
.admin-kpis {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.admin-kpis-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-kpi {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
}

.admin-kpi em {
  display: block;
  color: var(--mut);
  font-size: 12.5px;
  font-style: normal;
}

.admin-kpi b {
  display: block;
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.admin-kpi small {
  display: block;
  color: var(--fnt);
  font-size: 12px;
}

/* Retention while there are few events: an empty card in a dashed frame. */
.admin-kpi-ghost {
  border-style: dashed;
  background: transparent;
}

.admin-kpi-ghost b {
  color: var(--fnt);
}

.admin-stats-table th,
.admin-stats-table td {
  padding-inline: 10px;
  vertical-align: middle;
  white-space: nowrap;
}

.admin-stats-table thead th {
  font-size: 12.5px;
}

.admin-stats-table .admin-meter {
  width: 56px;
}

.admin-stats-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.admin-who b {
  font-weight: 600;
}

.admin-who a {
  color: var(--ink);
  text-decoration: none;
}

.admin-who a:hover {
  color: var(--blu);
  text-decoration: underline;
}

.admin-who em {
  display: block;
  color: var(--mut);
  font-size: 12.5px;
  font-style: normal;
  font-weight: 400;
}

.admin-stats-chip {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: var(--sf2);
  color: var(--mut);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-stats-chip-tester {
  border-color: var(--ochs);
  background: var(--ochs);
  color: var(--ochi);
}

.admin-dim :is(td, b, em, a) {
  color: var(--fnt);
}

/* The days of the week: a filled square is a day with an answer. */
.admin-dots {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}

.admin-dots i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--trk);
}

.admin-dots i.on {
  background: var(--blu);
}

/* The spending against a cap: a bar of the share and the sums. */
.admin-spend {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.admin-meter {
  display: inline-block;
  width: 90px;
  height: 6px;
  margin-right: 8px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--trk);
  vertical-align: middle;
}

.admin-meter i {
  display: block;
  width: calc(var(--share) * 100%);
  height: 100%;
  background: var(--blu);
}

.admin-kpi .admin-meter {
  width: 48px;
  margin-right: 4px;
}

.admin-retention-none {
  color: var(--fnt);
}

.admin-retention-none small {
  display: block;
  font-size: 12px;
}

.admin-stats-cards {
  display: none;
}

/* The page of one user: the attempts by day beside the summary. */
.admin-stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

.admin-box {
  padding: 18px;
  border: 1px solid var(--ln);
  border-radius: 8px;
  background: var(--sf);
}

.admin-box h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.admin-hist {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 90px;
  margin: 0;
  padding: 6px 0 0;
  list-style: none;
}

.admin-hist li {
  flex: 1;
  height: calc(var(--share) * 100%);
  min-height: 3px;
  margin: 0;
  border-radius: 3px 3px 0 0;
  background: var(--blu);
  list-style: none;
}

.admin-hist li.admin-hist-zero {
  border-radius: 1px;
  background: var(--trk);
}

.admin-axis {
  display: flex;
  justify-content: space-between;
  margin: 4px 0 0;
  color: var(--fnt);
  font-size: 11.5px;
}

/* The values wrap inside the card: the second column may shrink below its content. */
.admin-kv {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 16px;
  margin: 0;
  font-size: 14px;
}

.admin-kv dt {
  margin: 0;
  color: var(--mut);
  font-weight: 400;
  white-space: nowrap;
}

.admin-kv dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.admin-kv .admin-spend {
  white-space: normal;
}

@media (max-width: 1100px) {
  .admin-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .admin-stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 575.98px) {
  .admin-kpis,
  .admin-kpis-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Targets of a finger (section 2.1, rule 4). */
  .admin-period a,
  .admin-cohorts a,
  .admin-crumb a {
    min-height: 44px;
  }

  .admin-crumb a {
    display: inline-flex;
    align-items: center;
    min-width: 44px;
  }

  /* The labels of the summary of one user wrap on a narrow card. */
  .admin-kv dt {
    white-space: normal;
  }

  /* On a phone the rows of the users are cards, as in the sketch. */
  .admin-stats-table {
    display: none;
  }

  .admin-stats-cards {
    display: block;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .admin-stats-cards li {
    margin: 0 0 8px;
    list-style: none;
  }

  .admin-stats-cards a {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--ln);
    border-radius: 8px;
    background: var(--sf);
    color: var(--ink);
    font-size: 14px;
    text-decoration: none;
  }

  .admin-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .admin-card-top b {
    font-weight: 600;
  }

  .admin-card-line {
    display: block;
    margin-top: 2px;
    color: var(--mut);
    font-size: 13px;
  }
}
