/* Interlinear annotated-Chinese ({zh:…}) styling for the /know READING references
   (web/templates/know/reference.html — the programming + HSK-grammar refs). This now MATCHES
   the per-word hover / tap / keyboard behaviour: pinyin and translations appear in the
   shared floating .annotation-help popup, outside the sentence's layout. Hidden annotation
   rows reserve no space, so wrapped Chinese keeps normal line spacing. The full-sentence translation
   authored beneath each example is NOT rendered at all (user 2026-07-16: no whole-sentence
   translation on hover) — per-word glosses are the only reveal.

   Markup (web/zh_annotate.py): .lx-zh wraps the sentence (tabindex=0 → keyboard reveal); each
   .lx-w stacks an English gloss (.lx-w-en) over ruby pinyin (<rt>, tone-coloured .lx-tN) over
   the 汉字; a bare segment is punctuation (.lx-w-x). Tap / keyboard reveal (.is-open) is driven by
   the shared engine web/static/js/annotate-reveal.js. Page-scoped plain CSS — NOT in
   app.bundle.css, so no Tailwind/bundle rebuild (mirrors 20-simulate.css / 18-vocab.css). */

/* Per-syllable Mandarin tone colours: 1 high · 2 rising · 3 dip · 4 falling · 0 neutral. */
.lx-t1 { color: #f87171; } .lx-t2 { color: #fbbf24; } .lx-t3 { color: #34d399; }
.lx-t4 { color: #60a5fa; } .lx-t0 { color: #94a3b8; }

.lx-zh { cursor: default; }
/* Chinese is never bold, even inside a handout's **emphasis** (user steer: bold hanzi are harder
   for beginners to read, in sentences above all). The markup keeps the <strong>, so this is one
   line to undo. Numbering and English in the same <strong> stay bold. */
:is(strong, b) .lx-zh, :is(strong, b) .lx-zh ruby { font-weight: 400; }
.lx-zh:focus { outline: none; }
.lx-w {
  position: relative; display: inline-block; text-align: center; vertical-align: bottom;
  padding: 0 0.06em; border-radius: 0.3rem;
}
/* On hover/tap, a SUBTLE 1px ring (no fill) around the word — ties its pinyin + English to this
   汉字. box-shadow → no layout shift; follows the .lx-w border-radius. (user steer 2026-06-19) */
.lx-w.is-open { box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4); }
.lx-w ruby { display: inline; font-size: 1.5rem; line-height: 1.5; color: #eef2f7; }       /* readable hanzi */
.lx-w rt { display: none; } /* Kept in the DOM for the floating popup and screen-reader label. */
.lx-w-x { color: #cbd5e1; font-size: 1.5rem; vertical-align: bottom; padding: 0 0.05em; }   /* punctuation between words, sized + aligned to the hanzi */
.lx-w-en { display: none; } /* Read by annotate-reveal.js without adding height or width. */
/* Reveal — EXACTLY ONE word at a time. `.is-open` is set by the shared engine
   (web/static/js/annotate-reveal.js) for tap/click AND for keyboard walking (Tab onto the sentence,
   then ←/→). There is deliberately NO `.lx-zh:focus` rule: a touch tap focuses the sentence too
   (tabindex=0), so a focus-based reveal opened every word's pinyin + gloss at once on a phone
   (bug 2026-07-16). `:focus-visible` is no fix either — Chrome matches it on programmatic focus. */
/* Mouse hover, on pointer devices ONLY. Without the query a touch tap leaves :hover stuck on the
   word, so the previously-tapped word stayed revealed alongside the new one. */
@media (hover: hover) {
  .lx-w:hover { box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.4); }
}
/* Copy yields ONLY the 汉字 — pinyin (rt) + English gloss never enter the selection, so
   copying an annotated sentence gives clean Chinese. Hanzi + punctuation stay selectable. */
.lx-w rt, .lx-w-en { -webkit-user-select: none; user-select: none; }

/* Each example: the {zh} sentence in its own paragraph, with an English translation
   authored in the paragraph right beneath it (`*…*` after a blank line). The translation is
   NOT rendered — no always-on, no hover reveal (user 2026-07-16: hovering must show per-word
   glosses only; the full sentence translation spoils the read-it-yourself practice). It stays
   in the authored markdown for the PDFs, which keep their own rendering. */
.code-prose p:has(> .lx-zh), .learn-content-body p:has(> .lx-zh) { margin: 0.6rem 0; }
.code-prose p:has(> .lx-zh) + p, .learn-content-body p:has(> .lx-zh) + p { display: none; }

/* Auto-annotated inline Chinese in HSK handout prose (web/learn/annotate.py wraps each run in
   .lx-auto): the 汉字 sit at the surrounding prose size, not the big showcase size. */
.lx-auto .lx-w ruby, .lx-auto .lx-w-x { font-size: inherit; line-height: inherit; }
.lx-auto .lx-w-x { color: #eef2f7; }   /* punctuation matches the 汉字, not a bold run's accent colour */
.lx-auto .lx-w { display: inline; vertical-align: baseline; }   /* inline, so CJK line breaking never leaves 。 alone on a line */

/* HSK reading aids (web/chinese/aids.py): the authored pinyin and translation beside each
   example are hidden until the reader switches them on (know/_hsk_aids_toggle.html). */
.hsk-reading .hsk-py, .hsk-reading .hsk-en { display: none; }
html.hsk-show-py .hsk-reading .hsk-py, html.hsk-show-en .hsk-reading .hsk-en { display: inline; }
.hsk-aids-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
  margin: 0 0 0.75rem; padding: 0.55rem 0.8rem; border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem; background: rgba(255, 255, 255, 0.025);
}
.hsk-aids-hint { font-size: 0.8rem; color: #94a3b8; }
.hsk-aids-switches { display: inline-flex; gap: 0.4rem; }
.hsk-aids-switch {
  font-size: 0.78rem; font-weight: 600; color: #cbd5e1; padding: 0.3rem 0.7rem; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: transparent; cursor: pointer;
}
.hsk-aids-switch[aria-pressed="true"] { color: #a5f3fc; border-color: rgba(34, 211, 238, 0.5); background: rgba(34, 211, 238, 0.12); }
.hsk-aids-switch:focus-visible { outline: 2px solid rgba(34, 211, 238, 0.6); outline-offset: 2px; }
.learn-vocab-table--hsk td[lang="zh-Hans"] { font-size: 1.05rem; color: #eef2f7; }
.hsk-reading strong:has(> .lx-auto) { color: #eef2f7; }   /* a bold Chinese example: its punctuation matches the 汉字 */

/* Desktop HSK handouts: the site's 17 px prose in a 1,100 px column made the 汉字 hard to read
   (owner 11-29). Larger prose, and the inline Chinese a step above the English around it. */
@media (min-width: 1024px) {
  .hsk-reading .learn-content-body { font-size: 1.1875rem; line-height: 1.85; }
  .hsk-reading .learn-content-body .lx-auto { font-size: 1.12em; }
  .learn-vocab-table--hsk td[lang="zh-Hans"] { font-size: 1.3rem; }
}

/* ▼▼ LIGHT THEME — GENERATED by scripts/build_light_theme.py from the rules above. Do not edit by hand: run the builder. Hand tuning goes in 36-theme-light.css. ▼▼ */
html[data-theme="light"] .lx-t1{color:rgb(135 3 3)}
html[data-theme="light"] .lx-t2{color:rgb(127 92 0)}
html[data-theme="light"] .lx-t3{color:rgb(22 112 79)}
html[data-theme="light"] .lx-t4{color:rgb(1 66 146)}
html[data-theme="light"] .lx-t0{color:rgb(61 75 94)}
html[data-theme="light"] .lx-w.is-open{box-shadow:0px 0px 0px 1px rgb(77 94 116/0.55)}
html[data-theme="light"] .lx-w ruby{color:rgb(41 64 91)}
html[data-theme="light"] .lx-w-x{color:rgb(48 65 85)}
@media (hover: hover){html[data-theme="light"] .lx-w:hover{box-shadow:0px 0px 0px 1px rgb(77 94 116/0.55)}}
html[data-theme="light"] .lx-auto .lx-w-x{color:rgb(41 64 91)}
html[data-theme="light"] .hsk-aids-bar{border-color:rgb(15 23 42/0.112);background-color:rgb(15 23 42/0.025)}
html[data-theme="light"] .hsk-aids-hint{color:rgb(61 75 94)}
html[data-theme="light"] .hsk-aids-switch{color:rgb(48 65 85);border-color:rgb(15 23 42/0.18)}
html[data-theme="light"] .hsk-aids-switch[aria-pressed="true"]{color:rgb(1 111 124)}
html[data-theme="light"] .learn-vocab-table--hsk td[lang="zh-Hans"]{color:rgb(41 64 91)}
html[data-theme="light"] .hsk-reading strong:has(> .lx-auto){color:rgb(41 64 91)}
/* ▲▲ LIGHT THEME END ▲▲ */
