{"summary":"중국어·영어 조판에서 제목 줄바꿈, 숫자 흔들림, 텍스트 자르기, 중국어 세부 사항, 다국어 번역문 길이를 각각 어떻게 처리하는지 다룹니다.","notes":"<p>웹사이트 첫 화면의 제목 둘째 줄에 단어 하나만 남고, 카운트다운이 바뀔 때마다 옆 글자가 좌우로 흔들리고, 독일어로 바꾸면 버튼 글자가 두 줄로 밀려납니다. 이런 문제는 줄바꿈과 글자 폭에서 생기며, 대부분 CSS 몇 줄로 해결됩니다. 흔한 경우는 다음과 같습니다.</p>\n        <ol>\n        <li><strong>줄바꿈</strong>: 제목에는 <code>text-wrap: balance</code>를 써서 각 줄의 길이를 비슷하게 하고, 마지막 줄에 한두 단어만 남지 않게 합니다. 본문에는 <code>text-wrap: pretty</code>를 써서 문단 끝에 단어 하나만 남기지 않습니다. 버튼 글자에는 <code>white-space: nowrap</code>을 써서 항상 한 줄로 유지합니다.</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>: 같은 자리에 길이가 다른 번역문이 들어가야 합니다. 독일어 단어는 보통 영어보다 길어서, 영어로 딱 한 줄인 버튼도 독일어로는 넘칠 수 있습니다. 번역할 때는 Agent가 페이지 레이아웃을 고려해 알맞은 길이의 번역문을 고르게 하여, 한 단어가 두 줄로 나뉘거나 빈 공간이 너무 많이 남지 않게 합니다.</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"}