{"summary":"中国語と英語の組版で、見出しの改行、数字の揺れ、テキストの切り詰め、中国語の細部、多言語の訳文の長さをそれぞれどう扱うか。","notes":"<p>サイトのファーストビューの見出しで2行目に1語だけ残る、カウントダウンが進むたびに隣の文字が左右に揺れる、ドイツ語に切り替えるとボタンの文字が2行に押し出される。こうした問題は改行と文字幅が原因で、多くは数行の CSS で解決できます。よくあるものは次のとおりです：</p>\n        <ol>\n        <li><strong>改行</strong>：見出しには <code>text-wrap: balance</code> を使って各行の長さをそろえ、最終行に1〜2語だけ残らないようにします。本文には <code>text-wrap: pretty</code> を使い、段落末に1語だけ残さないようにします。ボタンの文字には <code>white-space: nowrap</code> を使い、常に1行に保ちます。</li>\n        <li><strong>数字</strong>：タイマー、価格、カウントなど変化する数字には <code>font-variant-numeric: tabular-nums</code> を使い、各数字を等幅にします。そうしないと 11 から 10 に変わるとき、「1」が「0」より細いため、後ろの文字が一緒に動きます。</li>\n        <li><strong>切り詰め</strong>：長いテキストに省略記号を表示するには、<code>text-overflow: ellipsis</code> に加えて、フレックスレイアウト内の要素に <code>min-width: 0</code> を指定します。フレックスの子要素の最小幅はデフォルトで内容の幅と同じなので、これがないとテキストがコンテナを押し広げ、省略記号が表示されません。</li>\n        <li><strong>中国語の本文</strong>：<code>text-align: justify</code> で両端揃えにし、行幅を文字数の整数倍にすると右端がそろいます。<code>text-autospace: normal</code> は中国語と英語・数字の間に自動で間隔を入れます。<code>text-spacing-trim: trim-start</code> は行頭の開き括弧の半角分の空きを取り除きます。</li>\n        <li><strong>中国語の見出しと禁則処理</strong>：見出しは BudouX で語の区切りを示し、<code>word-break: keep-all</code> と組み合わせて、語の途中で切らずに語単位で改行します。禁則処理はブラウザに任せ、それを無効にする <code>line-break: anywhere</code> は削除します。</li>\n        <li><strong>多言語</strong>：同じ位置に長さの異なる訳文を収める必要があります。ドイツ語の単語はふつう英語より長く、英語でちょうど1行に収まるボタンでも、ドイツ語では収まらないことがあります。翻訳するときは Agent にページのレイアウトを踏まえて長さの合う訳文を選ばせ、1つの語が2行に分かれることも、余白が残りすぎることも避けます。</li>\n        </ol>\n        <p>付属の Prompt は、これらのルールをグローバルスタイルに書き込んですべてのページに継承させます。調整するのは文字の改行、間隔、揃え、切り詰めだけで、文言、フォント、色は変えません。変更後は変更したファイルを一覧にし、あなたのページで変更前後を比較します。</p>","prompt":"Polish the typography in my product with a set of CSS switches. Change only how text wraps, spaces, aligns and truncates. No copy, font, colour or layout changes beyond what each rule says.\n\n0. Start from what exists\n- Put the rules in the global text styles (base CSS, typography tokens, Tailwind config or shared text components) so every page inherits them. Add per-component rules only where a component overrides the base.\n- Every rule below is progressive enhancement: browsers that don't know a property ignore it. Add no polyfills.\n- Scope the Chinese rules with :lang(zh), and make sure the lang attribute is set on the html element or on the element itself, so English text keeps its own rules.\n\n1. Headings break into even lines\n- On h1 to h3, card titles and hero lines: text-wrap: balance;\n- Lines come out about the same length, so a heading never ends on one lonely word. Short text only: Chrome balances up to 6 lines.\n\n2. No lone word at the end of a paragraph\n- On paragraphs, descriptions and list items: text-wrap: pretty;\n- Also join pairs that must not split with a non-breaking space (U+00A0): an em dash and the name after it, a number and its unit.\n\n3. Numbers that change keep their width\n- On anything that updates in place or sits in a column (counters, prices, timers, stats, table cells): font-variant-numeric: tabular-nums;\n- The font must have tabular figures (the tnum feature); check that the width actually stops changing. Leave running text proportional.\n\n4. Button labels stay on one line\n- On buttons and other labels in flex rows: white-space: nowrap; (flex-shrink: 0 works too)\n- A crowded row must not squeeze a label onto two lines.\n\n5. Long text truncates instead of spilling out\n- A flex item won't shrink below its content, so text inside it can't truncate. On the flex item: min-width: 0;\n- On the text itself: overflow: hidden; white-space: nowrap; text-overflow: ellipsis;\n- When the text really is cut (scrollWidth > clientWidth), show the full text in a tooltip on hover.\n\n6. Chinese body text: justified, on a whole number of characters\n- On Chinese paragraphs only: text-align: justify;\n- Set the measure to a whole number of characters (for example max-width: 26em at the paragraph's font size), so a justified line only stretches to absorb Latin words and squeezed punctuation.\n- Not for narrow columns (under about 15 characters), short text, captions, buttons or mostly-English text: the gaps get uneven.\n\n7. Space between Chinese and Latin text or numbers\n- On Chinese text: text-autospace: normal;\n- The browser adds a thin gap between Han characters and Latin letters or digits. Don't also hand-type spaces in copy or translation files. Skip code, inputs and monospaced text.\n\n8. No half-width gap before an opening bracket at a line start\n- On Chinese UI text without a first-line indent: text-spacing-trim: trim-start;\n- An opening 「 “ （ at the start of a line drops its blank half and lines up with the text above. Long-form text with a two-character indent should use space-first instead. Chrome only for now.\n\n9. Chinese headings break between words\n- Chinese has no spaces, so a heading can split a word across lines. Mark the break points between words with BudouX (its Simplified or Traditional Chinese model), inserting a wbr element at each one, at build time for static copy or at render time for dynamic copy. Then: word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance;\n- Never use keep-all on Chinese without break points: the heading becomes one unbreakable word. Don't use Intl.Segmenter for this (it splits common words wrongly), and don't apply it to body text.\n\n10. Line-start and line-end rules (避头尾)\n- Browsers already keep punctuation off the start of a line and squeeze line-end punctuation. Don't rebuild this.\n- Find and remove any line-break: anywhere used to stop overflow: it turns these rules off. Use overflow-wrap: anywhere instead.\n- Text drawn on canvas or SVG, or wrapped by hand in JS, gets none of this: apply the rules there yourself.\n\n11. When done\n- List every file and selector you changed.\n- List every line-break: anywhere and word-break: break-all you removed or kept, and why.\n- Show before and after on my own pages: a wrapped heading, a paragraph ending, a changing number, a truncated label and a mixed Chinese-English paragraph.","skill":"/skills/kubai-type-switches/SKILL.md","skillText":"# 中英文排版的CSS设置\n\n《999 个小技巧，让你 Vibe 的产品更有质感》第 007 期 · @kubai087\n\n在用户的项目里按下面的要求改造。要求以用户的口吻写成：文中的 I、me、my 指用户；写着要先问的地方，先停下来问用户再继续。\n\n## 改造要求\n\nPolish the typography in my product with a set of CSS switches. Change only how text wraps, spaces, aligns and truncates. No copy, font, colour or layout changes beyond what each rule says.\n\n0. Start from what exists\n- Put the rules in the global text styles (base CSS, typography tokens, Tailwind config or shared text components) so every page inherits them. Add per-component rules only where a component overrides the base.\n- Every rule below is progressive enhancement: browsers that don't know a property ignore it. Add no polyfills.\n- Scope the Chinese rules with :lang(zh), and make sure the lang attribute is set on the html element or on the element itself, so English text keeps its own rules.\n\n1. Headings break into even lines\n- On h1 to h3, card titles and hero lines: text-wrap: balance;\n- Lines come out about the same length, so a heading never ends on one lonely word. Short text only: Chrome balances up to 6 lines.\n\n2. No lone word at the end of a paragraph\n- On paragraphs, descriptions and list items: text-wrap: pretty;\n- Also join pairs that must not split with a non-breaking space (U+00A0): an em dash and the name after it, a number and its unit.\n\n3. Numbers that change keep their width\n- On anything that updates in place or sits in a column (counters, prices, timers, stats, table cells): font-variant-numeric: tabular-nums;\n- The font must have tabular figures (the tnum feature); check that the width actually stops changing. Leave running text proportional.\n\n4. Button labels stay on one line\n- On buttons and other labels in flex rows: white-space: nowrap; (flex-shrink: 0 works too)\n- A crowded row must not squeeze a label onto two lines.\n\n5. Long text truncates instead of spilling out\n- A flex item won't shrink below its content, so text inside it can't truncate. On the flex item: min-width: 0;\n- On the text itself: overflow: hidden; white-space: nowrap; text-overflow: ellipsis;\n- When the text really is cut (scrollWidth > clientWidth), show the full text in a tooltip on hover.\n\n6. Chinese body text: justified, on a whole number of characters\n- On Chinese paragraphs only: text-align: justify;\n- Set the measure to a whole number of characters (for example max-width: 26em at the paragraph's font size), so a justified line only stretches to absorb Latin words and squeezed punctuation.\n- Not for narrow columns (under about 15 characters), short text, captions, buttons or mostly-English text: the gaps get uneven.\n\n7. Space between Chinese and Latin text or numbers\n- On Chinese text: text-autospace: normal;\n- The browser adds a thin gap between Han characters and Latin letters or digits. Don't also hand-type spaces in copy or translation files. Skip code, inputs and monospaced text.\n\n8. No half-width gap before an opening bracket at a line start\n- On Chinese UI text without a first-line indent: text-spacing-trim: trim-start;\n- An opening 「 “ （ at the start of a line drops its blank half and lines up with the text above. Long-form text with a two-character indent should use space-first instead. Chrome only for now.\n\n9. Chinese headings break between words\n- Chinese has no spaces, so a heading can split a word across lines. Mark the break points between words with BudouX (its Simplified or Traditional Chinese model), inserting a wbr element at each one, at build time for static copy or at render time for dynamic copy. Then: word-break: keep-all; overflow-wrap: anywhere; text-wrap: balance;\n- Never use keep-all on Chinese without break points: the heading becomes one unbreakable word. Don't use Intl.Segmenter for this (it splits common words wrongly), and don't apply it to body text.\n\n10. Line-start and line-end rules (避头尾)\n- Browsers already keep punctuation off the start of a line and squeeze line-end punctuation. Don't rebuild this.\n- Find and remove any line-break: anywhere used to stop overflow: it turns these rules off. Use overflow-wrap: anywhere instead.\n- Text drawn on canvas or SVG, or wrapped by hand in JS, gets none of this: apply the rules there yourself.\n\n11. When done\n- List every file and selector you changed.\n- List every line-break: anywhere and word-break: break-all you removed or kept, and why.\n- Show before and after on my own pages: a wrapped heading, a paragraph ending, a changing number, a truncated label and a mixed Chinese-English paragraph.\n"}