/* Shared Chinese editorial wrapping; font families, copy and links stay with each page. */
@media screen {
  :where(h1,h2,h3,h4,p,li,figcaption,summary,button,.button,.card-copy,.lead,.intro,[data-wrap]) {
    word-break:normal;
    line-break:strict;
    overflow-wrap:break-word;
  }
  :where(h1,h2,h3,h4,[data-wrap="balance"],[data-wrap="phrase"],.page-masthead>div>p,.sectionhead>p,.hero .lead,.card-copy,.cta>div>p) {
    text-wrap:balance;
  }
  :where(p,li,figcaption,[data-wrap="prose"]) { text-wrap:pretty; }
  /* A clause is preferred as a unit, but can wrap internally on narrower screens. */
  .semantic-phrase { display:inline-block; max-inline-size:100%; vertical-align:bottom; white-space:normal; }
  :where(.button,button,[role="button"]) { max-inline-size:100%; white-space:normal; text-wrap:balance; }
  :where(.card-copy,.sectionhead>*,.service-intro-copy,.contact-paths>*,.directory-grid>a>*,.resource-grid>a>*) { min-inline-size:0; }
  [data-wrap="natural"] .semantic-phrase { display:inline; }
}
@media screen {
  .semantic-phrase { text-wrap:balance; }
  /* Existing tool layouts must give text real width before balancing its lines. */
  .tool-reservoir :is(.plan-grid,.plan-card,.teaching-card,.plan-grid>*,.planning-grid>*,.money-input input) { min-inline-size:0; }
  .tool-reservoir .three-risks h3 { letter-spacing:.03em; }
  .tool-reservoir .hero-left .lead { text-wrap:balance; }
  @media(max-width:900px) {
    .tool-reservoir .plan-grid { grid-template-columns:minmax(0,1fr); }
  }
  @media(max-width:650px) {
    .tool-reservoir .teaching-card { padding:24px 18px; }
    .tool-reservoir .teaching-card h2 { font-size:26px; letter-spacing:.03em; }
    .tool-reservoir .blueprint-grid,.tool-reservoir .planning-grid { grid-template-columns:minmax(0,1fr); gap:22px; }
    .tool-reservoir .planning-grid .channel-row { gap:10px; }
    .tool-reservoir .planning-grid .ch-box { min-width:0; flex:0 0 80px; padding:16px 8px; }
    .tool-reservoir .planning-grid .staff-box { padding:16px 12px; }
    .tool-reservoir .planning-grid .ch-label,.tool-reservoir .planning-grid .staff-box .title { letter-spacing:.03em; }
    .tool-reservoir .three-risks,.tool-reservoir .teaching-conclusion { padding:20px 16px; }
    .tool-reservoir .teaching-conclusion { font-size:20px; letter-spacing:.03em; }
    .tool-reservoir .money-input input { width:100%; }
  }
}
@media screen and (max-width:650px) {
  .tool-reservoir .blueprint>div[style] { margin-left:0!important; }
  .tool-reservoir .teaching-card .side-label { position:static; transform:none; writing-mode:horizontal-tb; padding:12px; margin-bottom:24px; font-size:18px; letter-spacing:.1em; }
  .tool-reservoir .building { padding:24px 14px; }
  .tool-reservoir .dream-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .tool-reservoir .dream-item { padding:20px 10px; font-size:18px; letter-spacing:.03em; }
  .tool-reservoir .bottom-floors { grid-template-columns:minmax(0,1fr); }
  .tool-reservoir .floor-item .title { white-space:normal; }
  .tool-allocation h3.flex:has(input) { flex-wrap:wrap; flex:1 0 100%; }
  .tool-allocation div:has(>h3.flex input),.tool-pledge div:has(>h2.flex) { flex-wrap:wrap; gap:12px; }
  .tool-pledge h2.flex { flex:1 0 100%; }
}
@media screen {
  .tool-reservoir .goals-table-scroll { max-inline-size:100%; overflow-x:auto; }
  .tool-reservoir .goals-table-scroll:focus-visible { outline:2px solid var(--accent); outline-offset:4px; }
  @media(min-width:651px) and (max-width:1100px) {
    .tool-reservoir .planning-grid { grid-template-columns:minmax(0,1fr); }
  }
}

@media screen { .semantic-word { display:inline-block; max-inline-size:100%; white-space:normal; text-wrap:balance; } }
/* Short UI and editorial copy shares the same balance rules, including dynamic cards. */
@media screen {
  .editorial-short { text-wrap:balance; }
  .semantic-phrase,.semantic-word { font:inherit; color:inherit; letter-spacing:inherit; }
  .insurance-shell>main { min-inline-size:0; }
  .insurance-shell .table-wrap { max-inline-size:100%; }
  @media(max-width:850px) { .insurance-shell { grid-template-columns:minmax(0,1fr); } }
  @media(max-width:650px) {
    .tool-reservoir .risk-actions { flex-wrap:wrap; }
    .tool-reservoir .risk-actions .btn { flex:1 1 10em; min-inline-size:8em; }
  }
}

@media screen { .content-intro-line { display:block; text-wrap:balance; } }
@media screen {
  .tool-reservoir .goals-table { min-inline-size:960px; table-layout:fixed; }
  .tool-reservoir .goals-table th:nth-child(2) { width:44px; }
  .tool-reservoir .goals-table th:nth-child(3) { width:180px; }
  .tool-reservoir .goals-table th:nth-child(4) { width:180px; }
  .tool-reservoir .goals-table :is(th,td) { word-break:normal; overflow-wrap:normal; }
  .table-scroll-hint { display:block; margin:10px 0; font-size:13px; color:#536879; }
  .tool-pledge .overflow-x-auto table { min-inline-size:760px; }
  .tool-pledge .overflow-x-auto::before { content:'左右滑動查看完整比較表'; display:block; position:sticky; left:0; padding:12px 16px; font-size:13px; color:#536879; background:#fff; }
  .tool-pledge .overflow-x-auto:focus-visible { outline:2px solid #ae8548; outline-offset:3px; }
  @media(min-width:651px) and (max-width:1100px) {
    .tool-reservoir .bottom-floors { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .tool-reservoir .floor-item { min-width:0; padding:20px 16px; }
    .tool-reservoir .floor-item .title { white-space:normal; }
    .tool-reservoir .dream-item { padding:22px 10px; letter-spacing:.03em; font-size:20px; }
  }
}

@media screen {
 .tool-allocation .allocation-target-row {flex-wrap:wrap;min-width:0;}
 .tool-allocation .allocation-target-row>textarea {flex:1 0 100%;width:100%;min-width:0;resize:vertical;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5;min-height:3em;}
 .tool-allocation .allocation-target-row>div {flex-shrink:0;}
 .tool-allocation .allocation-target-row>.no-print {opacity:1;margin-left:auto;}
 .tool-allocation .allocation-target-total {flex-wrap:wrap;}
 .tool-allocation .allocation-target-total>div:first-child {flex:1 0 100%;}
 .tool-allocation .allocation-target-total>div:last-child {display:none;}
 .tool-allocation .allocation-inventory-total {flex-shrink:0;}
 .tool-allocation .allocation-inventory-total>span {white-space:nowrap;}
 .tool-allocation .overflow-x-auto table {min-width:1100px;}
 @media(max-width:850px){
  .tool-allocation #pdf-content section {padding:20px 12px;}
  .tool-allocation .print-avoid-break>.h-full {padding:20px 12px;}
  .tool-allocation div:has(>.allocation-inventory-total) {flex-wrap:wrap;justify-content:flex-start;}
  .tool-allocation .p-4:has(>.whitespace-nowrap) {flex-wrap:wrap;gap:12px;}
 }
}

@media screen {
 .tool-investing :is(.calc,.calc-controls,.calc-out,.out-row,#contribPanel,.ctb-tablewrap,.lc-grid,.lc-col) {min-inline-size:0;max-inline-size:100%;}
 .tool-investing .calc {grid-template-columns:340px minmax(0,1fr);}
 .tool-investing .ctb-table {min-inline-size:650px;}
 .tool-investing .ctb-tablewrap:focus-visible {outline:2px solid var(--gold-soft);outline-offset:3px;}
 .tool-investing .ctb-tablewrap::before {content:'左右滑動查看完整年度表';display:block;position:sticky;left:0;padding:10px 12px;font-size:12px;color:var(--muted);}
 @media(max-width:1080px){.tool-investing .calc {grid-template-columns:minmax(0,1fr);}}
 @media(max-width:680px){
  .tool-investing .calc-controls {padding:18px 14px;}
  .tool-investing .seg {grid-template-columns:repeat(2,minmax(0,1fr));}
  .tool-investing .field label {flex-wrap:wrap;gap:4px 12px;}
  .tool-investing .field input[type=range] {width:100%;min-width:0;}
 }
}

@media screen {
 .insurance-shell .table-wrap::before {content:'左右滑動查看完整表格';display:block;position:sticky;left:0;padding:10px 16px;font-size:12px;color:#526b7b;background:white;}
 .insurance-shell .table-wrap:focus-visible {outline:2px solid #ae8548;outline-offset:3px;}
 @media(max-width:680px){
  .tool-investing :is(.opc-row,.opc-line,.opc-sub) {flex-direction:column;align-items:stretch;gap:10px;}
  .tool-investing .opc-sub {margin-left:0;}
  .tool-investing .opc-right {flex-wrap:wrap;justify-content:space-between;}
  .tool-investing .opc-val {white-space:normal;overflow-wrap:anywhere;}
 }
}

@media screen {
 .tool-framework .table-wrap table {min-inline-size:680px;}
 .tool-framework .table-wrap::before {content:'左右滑動查看完整比較表';display:block;position:sticky;left:0;padding:10px 12px;font-size:13px;color:var(--muted);}
 .tool-framework .table-wrap:focus-visible {outline:2px solid var(--gold);outline-offset:3px;}
}

@media screen {
 fm-title-line {display:block;}
 .tool-investing .lc-row {flex-wrap:wrap;gap:3px 10px;}
 .tool-investing .lc-row>span {flex:1 1 11em;min-inline-size:0;}
 .tool-investing .lc-row>b {margin-left:auto;}
 .tool-investing .faq-item.open .faq-a {max-height:none!important;}
}
@media screen {
 .insurance-shell .table-wrap table {min-inline-size:760px;table-layout:fixed;}
 .insurance-shell .table-wrap :is(th,td) {white-space:normal;overflow-wrap:break-word;}
}
@media screen {
 .tool-pledge .overflow-x-auto table {min-inline-size:1200px;}
 .tool-allocation .overflow-x-auto::before {content:'左右滑動查看完整再平衡表';display:block;position:sticky;left:0;padding:10px 16px;font-size:13px;color:#536879;background:#fff;}
 .tool-allocation .overflow-x-auto:focus-visible {outline:2px solid #ae8548;outline-offset:3px;}
}
@media screen and (max-width:650px) {
 .tool-allocation .allocation-target-toolbar {flex-wrap:wrap;gap:8px;}
 .tool-allocation .allocation-target-toolbar>span {flex-basis:100%;}
 .tool-allocation .allocation-target-toolbar>div {margin-left:auto;}
}

/* v60: two residual labels confirmed by the production UI review. */
@media screen {
 .tool-reservoir .hero-left .lead .highlight {display:inline-block;max-inline-size:100%;}
 .tool-allocation .allocation-summary-label>span {display:inline-block;}
 @media(max-width:650px){
  .tool-allocation .allocation-summary-title {flex-wrap:wrap;gap:8px;}
  .tool-allocation .allocation-summary-label {flex-basis:100%;min-inline-size:0;}
 }
}
