/* langs123 topic page — generated by scripts/topic.ts, after home.css */
html:is([data-page="home"], [data-page="track"], [data-page="topic"]) {
  --tp-sec: rgba(60, 60, 67, 0.6);
  --tp-mute: rgba(60, 60, 67, 0.45);
  --tp-hair: rgba(60, 60, 67, 0.29);
  --tp-body: #3c3c43;
  --tp-caps: #6e6e73;
  --tp-note: rgba(118, 118, 128, 0.08);
  --tp-dash: rgba(60, 60, 67, 0.33);
  --tp-seg-on: #ffffff;
  --tp-seg-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  --tp-fade: rgba(242, 242, 247, 0.85);
  --tp-edge: rgba(242, 242, 247, 0.96);
  --tp-sheet-shadow: 0 -4px 40px rgba(0, 0, 0, 0.18);
  --tp-back: rgba(0, 0, 0, 0.18);
  --tp-current: rgba(47, 91, 211, 0.08);
}
@media (prefers-color-scheme: dark) {
  html:is([data-page="home"], [data-page="track"], [data-page="topic"]):not([data-theme="light"]) {
    --tp-sec: rgba(235, 235, 245, 0.6);
    --tp-mute: rgba(235, 235, 245, 0.45);
    --tp-hair: rgba(84, 84, 88, 0.65);
    --tp-body: rgba(235, 235, 245, 0.85);
    --tp-caps: rgba(235, 235, 245, 0.55);
    --tp-note: rgba(118, 118, 128, 0.18);
    --tp-dash: rgba(235, 235, 245, 0.3);
    --tp-seg-on: #636366;
    --tp-seg-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    --tp-fade: rgba(0, 0, 0, 0.85);
    --tp-edge: rgba(0, 0, 0, 0.96);
    --tp-sheet-shadow: 0 -4px 40px rgba(0, 0, 0, 0.6);
    --tp-back: rgba(0, 0, 0, 0.5);
    --tp-current: rgba(126, 162, 255, 0.14);
  }
}
html:is([data-page="home"], [data-page="track"], [data-page="topic"])[data-theme="dark"] {
  --tp-sec: rgba(235, 235, 245, 0.6);
  --tp-mute: rgba(235, 235, 245, 0.45);
  --tp-hair: rgba(84, 84, 88, 0.65);
  --tp-body: rgba(235, 235, 245, 0.85);
  --tp-caps: rgba(235, 235, 245, 0.55);
  --tp-note: rgba(118, 118, 128, 0.18);
  --tp-dash: rgba(235, 235, 245, 0.3);
  --tp-seg-on: #636366;
  --tp-seg-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  --tp-fade: rgba(0, 0, 0, 0.85);
  --tp-edge: rgba(0, 0, 0, 0.96);
  --tp-sheet-shadow: 0 -4px 40px rgba(0, 0, 0, 0.6);
  --tp-back: rgba(0, 0, 0, 0.5);
  --tp-current: rgba(126, 162, 255, 0.14);
}

html[data-page="topic"] a { color: inherit; text-decoration: none; }
html[data-page="topic"] button { font: inherit; }
.tp-caps { margin: 0 0 8px 8px; font-size: 13px; line-height: 18px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--tp-caps); }
.tp-n { flex: none; font: 600 17px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: -0.02em; color: var(--tp-mute); }
.tp-chev { flex: none; color: var(--tp-mute); }
.tp-card { position: relative; margin: 0 0 18px; border-radius: 22px; background: var(--surface); overflow: hidden; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Levels: one pill, or two joined halves */
html[data-page="topic"] .badge { font-size: 12px; font-weight: 700; line-height: 1.6; letter-spacing: 0; --badge-pad: 0 7px; flex: none; }
html[data-page="topic"] .lvl { margin: 0; }
html[data-page="topic"] .tp-li > .lvl, html[data-page="topic"] .doc p > .lvl { margin: 0 8px 0 0; vertical-align: 2px; }

/* Glass: the up link, the toolbar and the bars */
.tp-up { position: fixed; top: 20px; left: 20px; z-index: 31; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; color: var(--text); }
.tp-top { position: fixed; top: 20px; right: 20px; z-index: 31; display: flex; gap: 10px; }
.tp-top .hm-group { height: 44px; }
.tp-btn { display: flex; align-items: center; justify-content: center; gap: 6px; height: 100%; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: inherit; font-size: 17px; white-space: nowrap; cursor: pointer; }
.tp-level .level-dot { width: 9px; height: 9px; }
.tp-level .level-dot:not(.one) { display: none; }
.tp-edge, .tp-fade { display: none; }
.tp-bar-left { display: none; }

/* The page: a head, the contents column and the lesson */
.tp-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 32px; max-width: 1040px; margin: 0 auto; padding: 84px 20px 140px; align-items: start; }
.tp-head { grid-column: 2; grid-row: 1; min-width: 0; }
.tp-rail { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 84px; max-height: calc(100vh - 84px - 24px); overflow-y: auto; scrollbar-width: none; }
.tp-main { grid-column: 2; grid-row: 2; min-width: 0; container-type: inline-size; }
.tp-main .doc { max-width: none; }
.tp-end { display: none; }
.tp-head .title-row { display: flex; align-items: baseline; gap: 8px; margin: 0; }
.tp-head .page-icon { font-size: 28px; line-height: 1.2; }
.tp-head h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: 0.01em; overflow-wrap: anywhere; }
.tp-head .doc-head { margin: 0; }
.tp-head .props { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 6px 0 12px; font-size: 15px; line-height: 22px; color: var(--tp-sec); }
.tp-head .props > :not(:first-child)::before { content: "·"; margin-right: 8px; color: var(--tp-mute); }
.tp-head .props a.prop { color: var(--accent); text-decoration: none; }
.tp-head .props .prop { display: inline-flex; align-items: center; gap: 4px; }
.tp-head .props .prop svg { flex: none; }
.tp-head .tabs { display: flex; gap: 2px; box-sizing: border-box; width: 300px; max-width: 100%; margin: 0 0 12px; padding: 2px; border-radius: 999px; background: var(--hm-fill); }
.tp-head .tabs button { flex: 1; height: 32px; margin: 0; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-size: 15px; font-weight: 500; letter-spacing: -0.2px; white-space: nowrap; cursor: pointer; }
.tp-head .tabs button.on { background: var(--tp-seg-on); box-shadow: var(--tp-seg-shadow); font-weight: 600; }
.tp-main .doc > blockquote:first-of-type { margin: 0 0 4px; font-size: 17px; line-height: 25px; letter-spacing: -0.43px; color: var(--tp-body); }
.tp-main .doc > blockquote p { margin: 0; }

/* The Cheatsheet: a row opens it from the full lesson; its table is the Cheatsheet view */
.tp-cheat { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; margin: 14px 0 0; padding: 0 16px 0 20px; border: 0; border-radius: 22px; background: var(--surface); color: var(--text); text-align: left; cursor: pointer; }
.tp-cheat .tp-n { margin-right: 0; }
.tp-ct { flex-grow: 1; font-size: 20px; line-height: 25px; font-weight: 700; letter-spacing: -0.45px; }
html[data-view="cheatsheet"] .tp-cheat, html:not([data-view="cheatsheet"]) .sections > .part.cheatsheet { display: none; }

/* Sections: a number, the title, the range pill */
.tp-main .sections > .part { scroll-margin-top: 90px; min-width: 0; }
.tp-main .doc h2 { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; padding: 0; border: 0; font-size: 20px; line-height: 25px; font-weight: 700; letter-spacing: -0.45px; }
.tp-main .doc h2 .badge { margin-left: auto; }
.tp-main .sections > .part > h2::before { content: attr(data-n); flex: none; margin: 0; font: 600 17px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: -0.02em; color: var(--tp-mute); }
.doc.one-level .sections > section > h2 .lvl { display: none; }
.tp-main .doc .blk { margin: 0; }
.blk-level { margin: 0 0 8px; }
.tp-main .doc p { margin: 0 0 14px; font-size: 17px; line-height: 25px; letter-spacing: -0.43px; }
.tp-main .doc p:has(> .tp-ex) { margin-bottom: 14px; }

/* Lists: a rule, a note, an example */
.tp-main .doc ul { margin: 0 0 14px; padding: 0; list-style: none; }
.tp-main .doc li { display: flex; gap: 12px; margin: 0 0 12px; font-size: 17px; line-height: 25px; letter-spacing: -0.43px; }
.tp-li { flex: 1; min-width: 0; }
.tp-main .doc li[data-type="rule"]::before { content: ""; flex: none; width: 6px; height: 6px; margin: 10px 0 0 4px; border-radius: 999px; background: var(--tp-mute); }
.tp-main .doc li[data-type="note"] { gap: 10px; padding: 10px 14px 10px 12px; border-radius: 14px; background: var(--tp-note); font-size: 16px; line-height: 22px; letter-spacing: -0.3px; color: var(--tp-body); }
.tp-main .doc li[data-type="note"]::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 2px; background: var(--tp-sec); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8.5' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M10 9v5' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='6' r='1.1' fill='black'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8.5' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M10 9v5' stroke='black' stroke-width='1.8' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='6' r='1.1' fill='black'/%3E%3C/svg%3E") center / contain no-repeat; }
.tp-main .doc li[data-type="example"] { margin-left: 4px; }
.tp-ex { display: flex; gap: 12px; margin-top: 6px; }
.tp-ex::before { content: ""; flex: none; width: 3px; border-radius: 2px; background: var(--accent); opacity: 0.55; }
.tp-ex-body { flex: 1; min-width: 0; color: var(--text); }
.tp-main .doc li[data-type="note"] .tp-ex-body { font-size: 17px; line-height: 25px; letter-spacing: -0.43px; }
li[data-type="example"] .tp-li > .tp-ex:first-child { margin-top: 0; }
.tp-tr { display: block; margin-top: 1px; font-size: 15px; line-height: 21px; letter-spacing: -0.2px; }

/* Marks: bold accent for the form a rule is about, muted italic for a sound or a meaning, IPA in mono */
.doc em[data-mark] { font-style: italic; color: var(--tp-sec); }
.doc [data-mark="ipa"] { white-space: nowrap; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.88em; letter-spacing: -0.02em; color: color-mix(in srgb, var(--text) 82%, transparent); }
.doc strong [data-mark="ipa"] { color: inherit; }
.doc .sl { font-style: normal; color: color-mix(in srgb, var(--text) 35%, transparent); }
.doc strong .sl { color: inherit; opacity: 0.5; }
.doc .nw { white-space: nowrap; }
.doc [data-mark="variant"][data-variety] { color: var(--tp-sec); }
.doc .vl { font-weight: 600; }
.tp-vtag { display: block; width: fit-content; margin-top: 3px; padding: 0 8px; border-radius: 999px; background: var(--hm-fill); color: var(--tp-sec); font-size: 12px; font-weight: 600; letter-spacing: 0; line-height: 1.6; }
.blk-level .tp-vtag { display: inline-block; margin: 0 0 0 6px; }
.doc .j { font-style: normal; color: var(--tp-mute); }
.doc a[data-mark="link"] { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
.doc [data-mark="slot"] { padding: 1px 7px; border-radius: 7px; background: var(--hm-fill); color: var(--tp-sec); font-size: 0.9em; white-space: nowrap; }
.doc [data-mark="optional"] { color: var(--tp-sec); }
.doc [data-mark="intonation"] { color: var(--accent); font-weight: 700; }
.doc [data-mark="gap"] { color: var(--tp-mute); letter-spacing: 0.12em; }
.doc [data-mark="variety"] { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; background: var(--hm-fill); color: var(--tp-sec); font-size: 12px; font-weight: 600; line-height: 1.6; vertical-align: 1px; white-space: nowrap; }

/* Tables: a card with a header row, hairlines between rows and the level pill in a last narrow column */
.tp-card .table-wrap { overflow-x: auto; margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.tp-main .tp-card table { width: 100%; border-collapse: collapse; font-size: 17px; line-height: 23px; letter-spacing: -0.3px; }
.tp-main .tp-card th { padding: 12px 10px 8px; border: 0; background: none; font-size: 13px; line-height: 17px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--tp-caps); text-align: left; vertical-align: bottom; }
.tp-main .tp-card th:has([data-mark]) { text-transform: none; letter-spacing: -0.3px; font-size: 15px; color: var(--text); }
.tp-main .tp-card td { padding: 11px 10px; border: 0; border-top: 0.5px solid var(--tp-hair); vertical-align: middle; }
.tp-main .tp-card tr:last-child td { border-bottom: 0; }
.tp-main .tp-card :is(th, td):first-child { padding-left: 20px; }
.tp-main .tp-card td.key { font-weight: 600; }
.tp-main .tp-card table.errors td.key { font-weight: 400; }
.tp-mono { font: 600 17px ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tp-letter { font-size: 22px; line-height: 26px; font-weight: 600; letter-spacing: 0.01em; }
.tp-main .tp-card .tp-lvl { width: 1%; padding-right: 16px; text-align: right; white-space: nowrap; }
.tp-main .tp-card td .badge { vertical-align: middle; }
.tp-main .tp-card table[data-type="comparison"] :is(th, td):not(:first-child, .tp-lvl) { border-left: 0.5px solid var(--tp-hair); }
.tp-main .tp-card td.tp-none { color: var(--tp-mute); }
.tp-main .tp-card .tp-trcol { font-style: italic; color: var(--tp-sec); }
.tp-main .tp-card td .tp-tr { margin-top: 2px; font-size: 15px; line-height: 19px; }
.tp-main .tp-card td .cell-variety { display: block; }

/* A slot paradigm, compact: grouped two-row header, centred cells, lines between columns, merged words, a pill per tense */
.tp-main .tp-slot-wide table.compact { border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 20px; }
.tp-main .tp-slot-wide table.compact th { padding: 9px 5px 6px; font-size: 11.5px; line-height: 15px; text-align: center; white-space: nowrap; }
.tp-main .tp-slot-wide table.compact th:first-child { padding-left: 14px; text-align: left; }
.tp-main .tp-slot-wide table.compact th.group { border-left: 0; border-bottom: 0.5px solid var(--tp-hair); color: var(--accent); }
.tp-main .tp-slot-wide table.compact thead tr + tr th { border-left: 0.5px solid var(--tp-hair); }
.tp-main .tp-slot-wide table.compact thead tr + tr th.group-start { border-left: 0; }
.tp-main .tp-slot-wide table.compact td { padding: 5px 6px; border: 0; border-left: 0.5px solid var(--tp-hair); text-align: center; white-space: nowrap; vertical-align: middle; line-height: 20px; }
.tp-main .tp-slot-wide table.compact td.key { padding-left: 14px; text-align: left; border-left: 0; }
.tp-main .tp-slot-wide table.compact td:first-child:not(.key) { padding-left: 6px; border-left: 0; }
.tp-main .tp-slot-wide table.compact td.key + td, .tp-main .tp-slot-wide table.compact td.gap + td { border-left: 0; }
.tp-main .tp-slot-wide table.compact tr:not(.tp-first):not(.gap-row) td:not([rowspan], .gap) { border-top: 0.5px solid var(--tp-hair); }
.tp-main .tp-slot-wide table.compact :is(th, td).gap { width: 8px; min-width: 8px; padding: 0; border: 0; background: var(--hm-bg); }
.tp-main .tp-slot-wide table.compact tr.gap-row td { height: 8px; padding: 0; border: 0; background: var(--hm-bg); }
.tp-main .tp-slot-wide table.compact td.tp-lvl { padding: 5px 12px 5px 5px; border: 0; }
.tp-main .tp-slot-wide table.compact th.tp-lvl { padding-right: 12px; border: 0; }
.tp-slot-cards { display: none; }
.tp-tense { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px 8px; font-size: 17px; line-height: 22px; font-weight: 600; }
.tp-tense span:first-child { flex-grow: 1; }
.tp-slot .tp-caps { margin: 4px 0 6px 8px; }
.tp-slot .tp-card { margin-bottom: 8px; }
.tp-main .tp-slot .tp-card td { padding: 9px 10px; font-size: 16px; line-height: 22px; }
.tp-main .tp-slot .tp-card tbody tr:first-child td { border-top: 0; }
.tp-main .tp-slot .tp-card td[rowspan] { border-top: 0; }
.tp-main .tp-slot .tp-card td:first-child { padding-left: 10px; }
.tp-main .tp-slot .tp-card td.c0 { padding-left: 20px; }

/* Errors: the wrong form struck through under a cross, the right one under a check, then the rule */
.tp-main .tp-card table.errors td:nth-child(1) { background: none; color: var(--tp-sec); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--lvl-A0-ink) 60%, transparent); }
.tp-main .tp-card table.errors td:nth-child(2) { background: none; }
.tp-main .tp-card table.errors td:nth-child(3):not(.tp-lvl) { color: var(--tp-sec); }
.tp-main .tp-card table.errors td:nth-child(1)::before, .tp-main .tp-card table.errors td:nth-child(2)::before { content: ""; display: inline-block; width: 13px; height: 13px; margin-right: 8px; vertical-align: -1px; }
.tp-main .tp-card table.errors td:nth-child(1)::before { background: var(--lvl-A0-ink); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M2 2l10 10M12 2L2 12' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M2 2l10 10M12 2L2 12' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.tp-main .tp-card table.errors td:nth-child(2)::before { background: var(--lvl-B1-ink); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 14' fill='none'%3E%3Cpath d='M1.5 7.5l4.5 4.5L14.5 1.5' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 14' fill='none'%3E%3Cpath d='M1.5 7.5l4.5 4.5L14.5 1.5' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.tp-main .tp-card table.errors td.tp-lvl::before { display: none; }

/* When the level filter leaves a view nothing: a dashed box and a button that shows the level */
.tp-main .filter-empty { margin: 0; padding: 22px 20px 20px; border: 1.5px dashed var(--tp-dash); border-radius: 22px; background: none; text-align: center; color: var(--tp-body); }
.tp-main .filter-empty p { margin: 0 0 16px; font-size: 17px; line-height: 25px; letter-spacing: -0.43px; }
.tp-main .filter-empty button { height: 44px; padding: 0 24px; border: 0; border-radius: 999px; background: var(--accent); color: var(--hm-on-accent); font-size: 17px; font-weight: 600; letter-spacing: -0.3px; cursor: pointer; }

/* The end of the lesson: Up next, then edit and print */
.up-next .tp-caps { margin: 18px 0 8px 8px; }
.tp-rail .tp-caps:first-child { margin-top: 0; }
.up-next a.next { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: 10px; padding: 14px 16px 14px 20px; border-radius: 22px; background: var(--surface); color: var(--text); }
.up-next a.next:hover { box-shadow: none; background: color-mix(in srgb, var(--surface) 94%, var(--text)); }
.up-next a.next strong { display: block; margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; letter-spacing: -0.43px; }
.up-next a.next .summary { grid-column: 1 / -1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 0 0; font-size: 15px; line-height: 20px; letter-spacing: -0.2px; color: var(--tp-sec); }
.up-next a.next .badge { grid-column: 2; grid-row: 1; }
.up-next a.next .tp-chev { grid-column: 3; grid-row: 1; }
.tp-tools { margin-top: 18px; }
.tp-main .page-tools { display: block; margin: 0; padding: 0; border: 0; border-radius: 22px; background: var(--surface); overflow: hidden; }
.tp-main .doc .page-tool { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; margin: 0; padding: 0 16px 0 20px; border: 0; background: none; color: var(--accent); font-size: 17px; letter-spacing: -0.43px; text-align: left; cursor: pointer; }
.tp-main .doc .page-tool + .page-tool { border-top: 0.5px solid var(--tp-hair); }
.tp-main .doc .page-tool:hover { color: var(--accent); background: var(--hm-fill); }

/* The contents column: numbers, titles, range pills, the current section marked */
.tp-contents .toc { margin: 0; padding: 0; list-style: none; }
.tp-contents .toc li + li::before { content: ""; display: block; height: 0.5px; margin-left: 20px; background: var(--tp-hair); }
.tp-contents .toc a { display: flex; align-items: center; gap: 10px; width: auto; min-height: 36px; padding: 0 16px 0 20px; border-radius: 0; color: var(--text); font-size: 17px; line-height: 22px; letter-spacing: -0.43px; }
.tp-contents .toc a:hover { background: var(--hm-fill); }
.tp-contents .toc a.on { background: var(--tp-current); color: var(--accent); font-weight: 600; }
.tp-contents .toc .tp-n { width: 22px; font-size: 15px; }
.tp-contents .toc a.on .tp-n { color: var(--accent); }
.tp-contents .toc .name { flex: 1; min-width: 0; padding: 8px 0; }
.tp-contents .toc .badge { margin: 0; }
.tp-main .toc > li, .tp-contents .toc > li { margin: 0; }
.tp-wrap.one-level .tp-contents .toc .badge { display: none; }
.tp-gap { height: 8px; background: var(--hm-bg); }
.tp-print { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 16px 0 20px; border: 0; background: none; color: var(--accent); font-size: 17px; text-align: left; cursor: pointer; }

/* Previous and Next: one glass capsule, the titles beside the arrows on wide screens */
.tp-bar { position: fixed; left: 0; right: 0; bottom: 30px; z-index: 30; display: flex; justify-content: center; pointer-events: none; }
.tp-bar > * { pointer-events: auto; }
.tp-pagers { display: flex; }
.tp-pager { display: flex; align-items: center; height: 48px; border-radius: 999px; color: var(--text); }
.tp-side { display: flex; align-items: center; justify-content: center; gap: 6px; height: 100%; padding: 0 16px; border-radius: 999px; font-size: 17px; white-space: nowrap; }
.tp-pt { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
a.tp-side:hover { background: var(--hm-fill); }
.tp-off { opacity: 0.3; }
.tp-div { width: 0.5px; height: 24px; background: var(--tp-hair); }
.tp-restart { font-weight: 600; }

/* Sheets and panels: along the bottom on phones, under the button on wider screens */
.tp-sheet[popover], .tp-panel.panel[popover] { box-sizing: border-box; margin: 0; border: 0; color: var(--text); background: var(--hm-bg); box-shadow: var(--tp-sheet-shadow); overflow-y: auto; }
.tp-sheet::backdrop, .tp-panel::backdrop { background: var(--tp-back); }
.tp-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px 12px 24px; }
.tp-sheet-head h2 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; }
.tp-x { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border-radius: 999px; color: var(--text); cursor: pointer; }
.tp-sheet[popover]:popover-open { display: flex; flex-direction: column; overflow: hidden; }
.tp-sheet-head { flex: none; }
.tp-sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 12px 20px; overscroll-behavior: contain; }
.tp-sheet-body .tp-card { margin-bottom: 0; }
.tp-sheet-body .tp-contents .toc a { min-height: 44px; }
.tp-sheet-body .tp-contents .toc .name { padding: 11px 0; }
.tp-index[popover] { inset: 74px 20px auto auto; width: 460px; max-width: calc(100vw - 32px); max-height: calc(100vh - 100px); border-radius: 30px; }
.tp-panel.panel[popover] { min-width: 0; width: 360px; max-width: calc(100vw - 16px); padding: 0 16px 16px; border-radius: 30px; }
.tp-panel .tp-sheet-head { padding: 16px 0 10px 8px; }
.tp-panel .seg { display: flex; gap: 2px; box-sizing: border-box; padding: 3px; border-radius: 999px; background: var(--hm-fill); }
.tp-panel .seg button { flex: 1; height: 40px; padding: 0; border: 0; border-radius: 999px; font-size: 16px; font-weight: 600; letter-spacing: -0.2px; cursor: pointer; }
.tp-panel .seg button[data-set-level] { color: var(--lvl); }
.tp-panel .seg button[data-set-level].on { background: var(--level-tint); color: var(--lvl); font-weight: 700; box-shadow: inset 0 0 0 2px var(--lvl); }
.tp-panel .seg button[data-set-variety] { background: transparent; color: var(--text); }
.tp-panel .seg button[data-set-variety].on { background: var(--tp-seg-on); box-shadow: var(--tp-seg-shadow); }
.tp-panel .panel-note { margin: 10px 4px 0; font-size: 13px; line-height: 18px; color: var(--tp-sec); }
.tp-seg { display: flex; gap: 2px; box-sizing: border-box; margin: 0 0 18px; padding: 2px; border-radius: 999px; background: var(--hm-fill); }
.tp-seg button { flex: 1; height: 32px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-size: 15px; font-weight: 500; letter-spacing: -0.2px; cursor: pointer; }
.tp-seg button.on { background: var(--tp-seg-on); box-shadow: var(--tp-seg-shadow); font-weight: 600; }
.tp-ix-h { display: flex; align-items: baseline; gap: 10px; margin: 0 0 8px 8px; font-size: 20px; line-height: 25px; font-weight: 700; letter-spacing: -0.45px; }
.tp-ix-h:has(.badge) { align-items: center; }
.tp-ix-sec { margin-bottom: 24px; }
.tp-ix-rows { margin: 0; padding: 0; list-style: none; border-radius: 22px; background: var(--surface); overflow: hidden; }
.tp-ix-rows li + li::before { content: ""; display: block; height: 0.5px; margin-left: 20px; background: var(--tp-hair); }
.tp-row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px 0 20px; }
.tp-row:hover { background: var(--hm-fill); }
.tp-rn { flex-grow: 1; min-width: 0; padding: 14px 0; font-size: 17px; line-height: 22px; letter-spacing: -0.43px; }
.tp-row .tp-tick { display: none; }
.tp-row[aria-current] { color: var(--accent); }
.tp-row[aria-current] .tp-rn { font-weight: 600; }
.tp-row[aria-current] .tp-tick { display: block; }
.tp-row[aria-current] .tp-chev { display: none; }

/* A narrow lesson column (a phone, the right page of the unfolded Duo): a slot table becomes cards by tense and
   sentence type, a table of five or more columns scrolls sideways with its first column fixed */
@container (max-width: 640px) {
  .tp-slot-wide { display: none; }
  .tp-slot-cards { display: block; }
  .tp-wide table { min-width: 540px; }
  .tp-scroll :is(th, td):first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
}
.tp-scroll::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 36px; background: linear-gradient(to right, transparent, var(--surface)); pointer-events: none; transition: opacity 0.15s; display: none; }
@container (max-width: 640px) { .tp-scroll::after { display: block; } }
.tp-scroll.tp-end-reached::after { opacity: 0; }

/* Wide screens: the lanes of a very wide page, the narrower layout of a tablet */
@media (min-width: 861px) {
  .tp-main .tp-card th:last-child, .tp-main .tp-card td:last-child { padding-right: 16px; }
}
@media (min-width: 861px) and (max-width: 1099px) {
  .tp-wrap { grid-template-columns: 280px minmax(0, 1fr); column-gap: 24px; padding: 84px 32px 140px 20px; }
  .tp-bar { left: 324px; right: 32px; }
}
@media (min-width: 1640px) {
  .tp-wrap { max-width: none; padding-inline: 32px; }
}
@container (min-width: 1200px) {
  .tp-main .lanes { max-width: none; }
}
.tp-main .lanes { --lane-col-gap: 32px; max-width: 820px; }
@container (min-width: 1200px) { .tp-main .lanes { max-width: none; } }
html[data-view="cheatsheet"] .tp-main .sections.lanes { display: block; max-width: none; }

/* Wide and short, an unfolded phone held horizontally: the contents on the left page, the lesson on the right,
   the controls in a vertical bar along the trailing edge */
@media (min-width: 900px) and (max-height: 800px) and (orientation: landscape) {
  .tp-wrap { grid-template-columns: 450px minmax(0, 1fr); column-gap: 56px; max-width: none; padding: 30px 88px 120px; }
  .tp-head { grid-column: 1; grid-row: 1; padding-top: 14px; }
  .tp-head .tabs { width: 100%; }
  .tp-rail { grid-row: 2; top: 20px; max-height: calc(100vh - 40px); }
  .tp-rail .up-next { display: none; }
  .tp-main { grid-row: 1 / span 2; padding-top: 14px; }
  .tp-contents .toc a { min-height: 40px; }
  .tp-top { top: 20px; right: 16px; flex-direction: column; align-items: flex-end; }
  .tp-top .hm-group { flex-direction: column; height: auto; }
  .tp-top .tp-btn, .tp-top .hm-read summary { width: 52px; height: 48px; padding: 0; }
  .tp-top .tp-label, .tp-top .hm-read summary span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tp-top .hm-menu { top: 0; right: calc(100% + 12px); }
  .tp-bar { left: auto; right: 16px; bottom: 20px; }
  .tp-pager { flex-direction: column; height: auto; }
  .tp-side { width: 52px; height: 48px; padding: 0; }
  .tp-pt:not(.tp-start) { display: none; }
  .tp-div { display: none; }
  .tp-ixgroup { display: flex; }
}

/* Phones: the up link and a glass group at the top, a glass bar at the bottom holding Contents and Index on the
   left and Previous and Next on the right; both hide while the reader scrolls down (html.bar-hidden) */
@media screen and (max-width: 860px) {
  .tp-wrap { display: block; padding: 76px 20px 140px; }
  .tp-rail { display: none; }
  .tp-head .tabs { width: 100%; }
  .tp-head h1 { font-size: 28px; }
  .tp-up { top: max(20px, calc(env(safe-area-inset-top) + 8px)); }
  .tp-top { top: max(20px, calc(env(safe-area-inset-top) + 8px)); }
  .tp-ixgroup { display: none; }
  .tp-top .tp-btn, .tp-top .hm-read summary { width: 50px; padding: 0; }
  .tp-top .tp-variety { width: auto; padding: 0 12px; }
  .tp-top .tp-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tp-top .tp-variety .tp-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .tp-top .hm-menu { top: calc(100% + 12px); bottom: auto; right: 0; }
  .tp-edge { display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 25; height: 56px; background: linear-gradient(to bottom, var(--tp-edge) 40%, transparent); pointer-events: none; }
  .tp-fade { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: 130px; background: linear-gradient(to bottom, transparent, var(--tp-fade) 60%); pointer-events: none; }
  .tp-bar { left: 16px; right: 16px; bottom: max(30px, calc(env(safe-area-inset-bottom) + 8px)); justify-content: space-between; }
  .tp-bar-left { display: flex; height: 48px; }
  .tp-bar-left .tp-btn { width: 52px; padding: 0; }
  .tp-side { width: 52px; padding: 0; }
  .tp-pt:not(.tp-start) { display: none; }
  .tp-div { display: none; }
  .tp-restart { width: auto; padding: 0 16px; }
  .tp-restart .tp-pt { display: inline; }
  .tp-up, .tp-top, .tp-bar { transition: transform 0.25s ease; }
  html.bar-hidden .tp-up, html.bar-hidden .tp-top { transform: translateY(-120px); }
  html.bar-hidden .tp-bar { transform: translateY(calc(100% + 60px)); }
  html.bar-hidden .tp-fade { opacity: 0; }
  .tp-fade { transition: opacity 0.25s ease; }
  .tp-end { display: block; }
  .tp-end .up-next .tp-caps { margin-top: 26px; }
  .tp-main .tp-card table { font-size: 15px; line-height: 21px; }
  .tp-main .tp-card td { padding: 9px 8px; }
  .tp-main .tp-card :is(th, td):first-child { padding-left: 20px; }
  .tp-main .tp-card th { padding: 12px 8px 8px; }
  .tp-main .tp-card td .tp-tr { font-size: 14px; line-height: 19px; }
  .tp-main .tp-card .table-wrap { -webkit-overflow-scrolling: touch; }
  .tp-main .tp-card table.errors, .tp-main .tp-card table.errors tbody { display: block; }
  .tp-main .tp-card table.errors thead { display: none; }
  .tp-main .tp-card table.errors tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 11px 16px 11px 20px; border-top: 0.5px solid var(--tp-hair); }
  .tp-main .tp-card table.errors tr:first-child { border-top: 0; }
  .tp-main .tp-card table.errors td { display: block; grid-column: 1; padding: 0; border: 0; font-size: 17px; line-height: 25px; letter-spacing: -0.43px; }
  .tp-main .tp-card table.errors td:nth-child(3):not(.tp-lvl) { margin: 2px 0 0 22px; font-size: 15px; line-height: 20px; }
  .tp-main .tp-card table.errors td.tp-lvl { grid-column: 2; grid-row: 1 / span 3; padding: 0 0 0 12px; }
  .tp-main .tp-card table.errors td.tp-lvl:nth-child(3) { grid-row: 1 / span 2; }
  .tp-sheet[popover], .tp-panel.panel[popover]:not([style*="top"]), .tp-panel.panel[popover] { inset: auto 8px 8px 8px; width: auto; max-width: none; max-height: calc(100dvh - 100px); padding: 0; border-radius: 40px; }
  .tp-sheet[popover]::before, .tp-panel.panel[popover]::before { content: ""; position: absolute; left: 50%; top: 6px; width: 36px; height: 5px; margin-left: -18px; border-radius: 999px; background: var(--tp-hair); }
  .tp-panel .tp-sheet-head { padding: 20px 16px 12px 24px; }
  .tp-panel .seg, .tp-panel .panel-note { margin-left: 12px; margin-right: 12px; }
  .tp-panel .seg { margin-bottom: 0; }
  .tp-panel .panel-note { margin-bottom: 20px; }
  .tp-panel .seg { max-width: none; overflow: visible; }
  .tp-index[popover] { inset: auto 8px 8px 8px; width: auto; max-width: none; max-height: calc(100dvh - 100px); }
  .tp-seg { margin-bottom: 18px; }
}
@media screen and (max-width: 860px) and (prefers-reduced-motion: reduce) {
  .tp-up, .tp-top, .tp-bar, .tp-fade { transition: none; }
}

/* Print: A4, one column, the chrome hidden, square cards with hairline borders, pills as outlines */
@media print {
  @page { size: A4; margin: 16mm; @bottom-left { font: 11px sans-serif; color: #6e6e73; } @bottom-right { content: counter(page) " / " counter(pages); font: 11px sans-serif; color: #6e6e73; } }
  .tp-up, .tp-top, .tp-bar, .tp-fade, .tp-edge, .tp-rail, .tp-sheet, .tp-panel, .tp-tools, .tp-end, .tp-cheat, .tp-slot-cards, .tabs { display: none !important; }
  html[data-page="topic"] body { background: #fff; color: #000; font-size: 11pt; }
  .tp-wrap { display: block; max-width: none; padding: 0; }
  .tp-main .sections > .part.cheatsheet { display: block !important; }
  html[data-view="cheatsheet"] .tp-main .sections > .part:not(.cheatsheet) { display: none; }
  .tp-main .sections.lanes { display: block; }
  .tp-card { border-radius: 0; background: #fff; border: 0.75px solid #8a8a8e; box-shadow: none; break-inside: avoid; }
  html[data-page="topic"] .lvl > .half { background: #fff; box-shadow: inset 0 0 0 0.75px var(--lvl); }
  .doc [data-mark="slot"], .tp-main .doc li[data-type="note"], .tp-head .tabs button { background: #eeeeef; }
  .tp-main .tp-slot-wide table.compact td { padding: 4px 4px; font-size: 12px; }
  .tp-main .tp-slot-wide table.compact td.tp-lvl { padding: 4px 6px 4px 2px; }
  .tp-main .tp-slot-wide table.compact th { padding-left: 3px; padding-right: 3px; font-size: 10.5px; }
  .tp-main .doc h2, .tp-slot h3 { break-after: avoid; }
  .tp-head .props a.prop { color: #1f3f9c; }
}
