/* Forum49 native system fonts. No webfont download; prior159 is retained. */

/* Post/editor text follows the device's system font; original sizing and flow rules stay. */
body:not(.page-admin):not(.admin) :is([component="post/content"],.post-content,.pi-unlocked,.ql-editor){--f49-grid-font:-apple-system,BlinkMacSystemFont,system-ui,sans-serif!important;font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif!important;font-variant-numeric:lining-nums tabular-nums!important;font-feature-settings:"tnum" 1!important;letter-spacing:normal!important;word-spacing:normal!important;tab-size:4!important;}
body:not(.page-admin):not(.admin) :is([component="post/content"],.post-content,.pi-unlocked,.ql-editor) :where(p,h1,h2,h3,h4,h5,h6,blockquote,li,span,font,a,strong,b,em,i,s,del,u,mark,small,pre,code,.ql-code-block-container,.ql-code-block):not(:where(svg,svg *,button,button *,input,textarea,select,.ql-ui,.ql-ui *,.ql-cursor,.ql-cursor *,.fa,.fas,.far,.fab,.glyphicon,[class*="fa-"],.pi-card,.pi-card *,.history-records-card,.history-records-card *,.pi-unlocked-note,.pi-unlocked-note *)){font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif!important;font-variant-numeric:lining-nums tabular-nums!important;font-feature-settings:"tnum" 1!important;letter-spacing:normal!important;word-spacing:normal!important;tab-size:4!important;}
body:not(.page-admin):not(.admin) :is([component="post/content"],.post-content,.pi-unlocked,.ql-editor) :where(.pi-card,.history-records-card,.pi-unlocked-note,button,input,textarea,select){font-family:var(--forum-font,system-ui,sans-serif)!important;font-variant-numeric:normal!important;font-feature-settings:normal!important;}

/* Forum49 native UI font layer. Replaces the previous159 font-family choices.
   Font family only: retain author typography, sizes, weight, color and flow.
   Device-native Latin and CJK fonts; no embedded or remote font resource.
   Keep --sans/--serif intact: legacy brand and calligraphic designs use them. */
body{
  --f49-ui-font:-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  --forum-font:var(--f49-ui-font)!important;
  font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif!important;
}

/* Ordinary textual UI, including native form controls. No wildcard selector.
   Post/editor scope and semantic-code exclusions keep their existing boundaries.
   SVG/icons/emoji/branding/lettered seals retain their own font purpose. */
body
:is(h1,h2,h3,h4,h5,h6,p,a,span,label,legend,caption,summary,button,input,textarea,select,option,optgroup,li,dt,dd,th,td,time,small,strong,b,em,address,figcaption):not(:where(
  [component="post/content"],[component="post/content"] *,
  .post-content,.post-content *, .pi-unlocked,.pi-unlocked *,
  .ql-editor,.ql-editor *,
  pre,pre *,code,code *,kbd,kbd *,samp,samp *,
  .ql-code-block-container,.ql-code-block-container *, .ql-code-block,.ql-code-block *,
  .hljs,.hljs *,[class^="language-"],[class^="language-"] *,
  .brand,.brand *, .brand-domain-logo,.brand-domain-logo *,
  .brand-wordmark,.brand-wordmark *, .brand-name,.brand-name *,
  .navbar-brand,.navbar-brand *, .shell .hero #brand,.shell .hero #brand *,
  .route-modal-brand,.route-modal-brand *,
  .brand-num,.brand-num *, .brand-words,.brand-words *,
  .brand-address,.brand-address *, .brand-community-label,.brand-community-label *,
  .generation-banner,.generation-banner *,
  .address-main strong,.era-domain,.section-number,.portal-addresses strong,
  .channel-sign,.channel-sign *, .channel-symbol,.channel-symbol *,
  .author-seal,.author-seal *, .shortcut-seal,.shortcut-seal *,
  .archive-seal,.archive-seal *,
  .fr-year-seal,.fr-year-seal *, .fr-index,.fr-index *,
  .fr-animal-seal,.fr-animal-seal *, .fr-element-label,.fr-element-label *,
  .fr-header h2,.fr-header h2 *, .archive-hero h1,.archive-hero h1 *,
  .v6-category-hero h1,.v6-category-hero h1 *, .page-intro h1,.page-intro h1 *,
  svg,svg *, [role="img"],[role="img"] *,
  .fa,.fas,.far,.fal,.fab,.fad,.fat,.fass,
  [class^="fa-"],[class*=" fa-"], .glyphicon,
  .material-icons,.material-symbols-outlined,
  .emoji,.emojione,.twemoji,.f49-chat-emoji-choice,
  [data-f49-emoji-upload]
)){
  font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif!important;
}

/* Text-bearing containers with their own old system-ui declarations. */
body :is(
  .f49-friends-panel,.f49-friends-root,.f49-add-friend-root,
  .f49-group-root,.f49-group-directory-root,.f49-friend-requests-root,
  .f49-follow-alerts-conversation,.f49-follow-alerts-root,
  .f49-chat-page-title,.f49-chat-page-status,.f49-chat-simple,
  .f49-chat-search-status,.f49-chat-search-room-title,.f49-chat-search-time,
  .f49-chat-search-sender,.f49-chat-search-text,.f49-chat-search-pager,
  .f49-chat-friend-reminder,.f49-chat-voice-status,
  .f49-my-profile,.f49-my-first-paint-shell,
  .f49-app-promo-header,.f49-app-promo-rail,.f49-app-promo-modal,.f49-app-promo-tablet,
  .f49-follow-guide,.pi-copy-success-panel,
  .draw-admin,.draw-history,.forum-draws,.draw-save-notice,.draw-confirm
){
  font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif!important;
}

/* A family-only rule outranks the existing navigation's three IDs.
   In particular, keep the badge's 0/10px text sizing and pseudo content. */
body #friends-bottom-nav#friends-bottom-nav#friends-bottom-nav#friends-bottom-nav,
body #friends-bottom-nav#friends-bottom-nav#friends-bottom-nav#friends-bottom-nav .friends-nav-item,
body #friends-bottom-nav#friends-bottom-nav#friends-bottom-nav#friends-bottom-nav .friends-nav-label,
body #friends-bottom-nav#friends-bottom-nav#friends-bottom-nav#friends-bottom-nav :is(.friends-chat-unread,.friends-notification-unread,.friends-contact-requests),
body #friends-bottom-nav#friends-bottom-nav#friends-bottom-nav#friends-bottom-nav :is(.friends-chat-unread,.friends-notification-unread,.friends-contact-requests)::after{
  font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif!important;
}

/* Inherited brand text keeps its original sans stack; each wordmark/domain/
   seal's explicit Georgia/Arial/monospace/Kaiti/Songti rule stays untouched. */
body :is(.brand,.brand-domain-logo,.brand-community-label,.generation-banner,.generation-inner){
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",system-ui,sans-serif!important;
}

/* Keep native icon fonts nested inside textual navigation controls intact. */
body .f49-contact-actions>.f49-contact-delete{font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif!important}

/* The Hong Kong directory uses the same cached file from its own origin.
   Its Songti wordmark and dialog brand remain explicitly excluded above. */
body :is(.shell,.directory,.route-modal){font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif!important}

/* Shape-only candidate. No dimensions, spacing, typography, opacity or layout changes.
 * Square graphics share the approved continuous-corner path. Plain rounded
 * rectangles remain the fallback; old WebKit gets the prefixed mask property.
 * Never mask whole rows/cards: unread badges may extend outside the graphic.
 */
:root{
  --f49-corner-control:10px;
  --f49-corner-field:9px;
  --f49-corner-card:16px;
  --f49-corner-dialog:20px;
  --f49-corner-chip:6px;
  --f49-corner-square:22.5%;
  --f49-corner-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath fill='white' d='M50,0 C72,0 83,0 91.5,8.5 C100,17 100,28 100,50 C100,72 100,83 91.5,91.5 C83,100 72,100 50,100 C28,100 17,100 8.5,91.5 C0,83 0,72 0,50 C0,28 0,17 8.5,8.5 C17,0 28,0 50,0 Z'/%3E%3C/svg%3E");
}

/* All semantic actions, including native administration. No overflow clipping:
 * focus rings, menus, notification dots and text remain outside their boxes.
 * The second scope clears existing NodeBB !important corner overrides.
 */
body button,body .btn,body [role="button"],body input[type="button"],body input[type="submit"],body input[type="reset"],
body #panel#panel#panel#panel #content :is(button,.btn,[role="button"],input[type="button"],input[type="submit"],input[type="reset"]),
body :is(.download,.home,.portal-enter,.portal-record,.portal-join-actions a,.branches a,.account-links .btn,.f49-app-promo-header,.f49-app-promo-actions a,.f49-app-promo-rail b,.f49-app-tablet-action>span,.f49-my-entry,.f49-my-copy-id,.f49-my-save,.f49-my-unfollow,.f49-my-logout,.f49-friends-follow,.f49-friends-message,.f49-friends-refresh,.f49-friends-state-action,.f49-contact-more,.f49-chat-more,.f49-group-refresh,.f49-group-back,.f49-group-directory-refresh,.f49-friend-requests-refresh,.f49-conversation-more,.f49-conversation-load-more,.f49-conversation-swipe-delete,.f49-contact-delete,.analytics-legacy-links a,.segmented a),
body .f49-conversation-actions button,
body .f49-friend-request-actions button,
body .f49-follow-alerts-toolbar button,
body .f49-follow-alerts-pagination button,
body .f49-friends-pagination button,
body .f49-group-pagination button,
body .f49-group-directory-pagination button{
  border-radius:10px!important;
  border-radius:var(--f49-corner-control,10px)!important;
}

/* Text fields only. Native radio/checkbox/range/color/file appearances stay
 * intact; the upload button itself can use these corners without recropping.
 */
body input:not([type]),body input[type="text"],body input[type="email"],body input[type="password"],body input[type="search"],body input[type="url"],body input[type="tel"],body input[type="number"],body input[type="date"],body input[type="datetime-local"],body input[type="time"],body input[type="month"],body input[type="week"],body select,body textarea,body .form-control,body .form-select,body .input-group-text,
body #panel#panel#panel#panel #content :is(input:not([type]),input[type="text"],input[type="email"],input[type="password"],input[type="search"],input[type="url"],input[type="tel"],input[type="number"],select,textarea,.form-control,.form-select){
  border-radius:9px!important;
  border-radius:var(--f49-corner-field,9px)!important;
}
input[type="file"]::file-selector-button{border-radius:10px!important}
input[type="file"]::-webkit-file-upload-button{border-radius:10px!important}

/* Named functional surfaces only. Preserve existing scrolling/overflow, so a
 * long post, dropdown, chart, editor or table never receives a stretched mask.
 */
body .card,body .panel,body .alert,body .toast,body .popover,body .dropdown-menu,body .list-group,body .table-responsive{
  border-radius:16px!important;
  border-radius:var(--f49-corner-card,16px)!important;
}
body.page-login:not(.page-admin):not(.admin) #panel#panel#panel#panel #content>.login,
body.page-register:not(.page-admin):not(.admin) #panel#panel#panel#panel form[component="register/local"]{
  border-radius:16px!important;
  border-radius:var(--f49-corner-card,16px)!important;
}
body :is(.card,.panel,.login,.register,.alert,.toast,.popover,.dropdown-menu,.list-group,.table-responsive,.channel-card,.address-card,.ranking-channel,.ranking-board,.post-shortcut,.join-strip,.portal-results,.portal-masters,.portal-join,.portal-tabs,.draw-card,.trend-card,.archive-panel,.archive-hero,.topic-ranking,.v6-category-hero,.v6-category-main,.v6-category-aside-card,.post-container,.post-container-parent,.forum-comments-status,.forum-comment-editor,.composer,.friends-visual-box,.pi-card,.pi-unlocked-note,.history-records-card,.f49-app-promo-rail,.f49-app-promo-tablet,.f49-my-identity-card,.f49-my-row-group,.f49-my-nickname-form,.f49-my-email-form,.f49-my-following-list,.f49-my-email-notice,.f49-friends-state,.f49-group-list,.f49-friend-record-confirm,.analytics-toolbar,.analytics-tabs,.analytics-funnel,.analytics-entry-union,.analytics-card,.analytics-block,.analytics-table-wrap,.analytics-preview,.fr-reference,.fr-panel,.fr-zodiac-card,.case,.continue-note,.vpn-tip),
body #panel#panel#panel#panel #content :is(.card,.panel,.login,.register,form[component="register/local"],.post-container,.post-container-parent,.forum-comments-status,.forum-comment-editor,.topic-ranking,.v6-category-hero,.v6-category-main,.v6-category-aside-card,.composer,.friends-visual-box,.pi-card,.pi-unlocked-note,.history-records-card){
  border-radius:16px!important;
  border-radius:var(--f49-corner-card,16px)!important;
}
body #friends-bottom-nav#friends-bottom-nav#friends-bottom-nav#friends-bottom-nav{
  border-radius:16px!important;
  border-radius:var(--f49-corner-card,16px)!important;
}
body :is(.modal-content,.f49-app-promo-dialog,.f49-conversation-dialog,.f49-chat-more-menu,.f49-chat-emoji-panel,.f49-my-preview){
  border-radius:20px!important;
  border-radius:var(--f49-corner-dialog,20px)!important;
}

/* Square number blocks and small interface labels. Do not round individual
 * table cells, zodiac/element SVG artwork, or user-authored highlighted spans.
 * Badges only receive a radius: their text and outlying notification position
 * are never masked, clipped, resized or moved.
 */
body :is(.ball-number,.fr-number,.fr-index,.fr-year-seal,.fr-animal-seal,.fr-element-label,.badge,.label,.friends-vip-badge,.f49-friends-count,.f49-group-selected-chip,.f49-follow-alert-kind,.facts>span,.fr-toggle),
body .generation-tag,body .generation-domain b{
  border-radius:6px!important;
  border-radius:var(--f49-corner-chip,6px)!important;
}

/* Larger draw blocks and the smaller reference chips keep distinct scales. */
body .ball-number{border-radius:8px!important}
body .fr-number{border-radius:5px!important}

/* Hong Kong public directory. Browser Chrome/Safari symbols and their ::after
 * artwork remain untouched; only the surrounding options/actions/surfaces round.
 */
.shell>.directory,.shell .directory,.directory .route,.directory .slots>.route,.directory .slots>.slot,.directory .slot-actions,.directory .browser-option,.directory .browser-tip,#route-status{
  border-radius:16px!important;
  border-radius:var(--f49-corner-card,16px)!important;
}
.route-modal{border-radius:20px!important;border-radius:var(--f49-corner-dialog,20px)!important}
.route-modal-actions button,.directory button,.directory .route,.slot-actions button,.slot-actions a{
  border-radius:10px!important;
  border-radius:var(--f49-corner-control,10px)!important;
}

/* Graphic bodies only. Excluded deliberately: main-avatar/avatar-tooltip/rows,
 * notification badges, brand SVGs/wordmarks, browser logos, bottom-nav line
 * masks, emoji, favicon, message attachments and all ordinary content images.
 * Category avatars that were hidden stay hidden: no display rule is changed.
 */
body .f49-app-promo-icon,
body img[src="/forum-ui/app-logo-5d34e6eec3506df8.png"],
body .f49-contact-new-icon,
body .f49-contact-groups-icon,
body .f49-follow-alerts-icon,
body .f49-friends-state-icon,
body .portal-channel-sign,
body .channel-sign,
body .channel-symbol,
body .portal-tab-check,
body .avatar,
body .user-icon,
body img.avatar-rounded,
body span.avatar-rounded,
body img[component="user/picture"],
body span[component="user/picture"],
body .f49-friends-avatar,
body .f49-my-avatar,
body .f49-my-preview-avatar{
  border-radius:22.5%!important;
  border-radius:var(--f49-corner-square,22.5%)!important;
  overflow:hidden;
  -webkit-mask-image:var(--f49-corner-mask);
  mask-image:var(--f49-corner-mask);
  -webkit-mask-repeat:no-repeat;
  mask-repeat:no-repeat;
  -webkit-mask-position:center;
  mask-position:center;
  -webkit-mask-size:100% 100%;
  mask-size:100% 100%;
}

/* Clear an inner photograph's old circle; the outer graphic alone clips it.
 * Do not apply this to the crop/upload UI or manufacture missing photo pixels.
 */
body .avatar>img,body .user-icon>img,body .f49-friends-avatar>img,body .f49-my-avatar>img,body .f49-my-preview-avatar>img{
  border-radius:0!important;
  -webkit-mask-image:none!important;
  mask-image:none!important;
}

/* The one approved paint exception fills only the official App PNG's old
 * transparent corners with its existing opaque edge color (RGB13,88,71).
 */
body .f49-app-promo-icon,body img[src="/forum-ui/app-logo-5d34e6eec3506df8.png"]{background-color:#0d5847}

/* With a real alpha mask, avoid double-clipping by a normal circular corner.
 * Unsupported engines keep the ordinary22.5% rounded-rectangle fallback.
 */
@supports ((-webkit-mask-image:linear-gradient(#000,#000)) or (mask-image:linear-gradient(#000,#000))){
  :root{--f49-corner-square:0px}
}

/* Optional enhancement only; compatibility never depends on corner-shape. */
@supports (corner-shape:squircle){
  body :is(button,.btn,[role="button"],input[type="button"],input[type="submit"],input[type="reset"],input:not([type]),input[type="text"],input[type="email"],input[type="password"],input[type="search"],input[type="url"],input[type="tel"],input[type="number"],select,textarea,.form-control,.form-select,.card,.panel,.modal-content,.alert,.toast,.popover,.dropdown-menu,.portal-results,.portal-masters,.portal-join,.draw-card,.archive-panel,.post-container-parent,.f49-my-identity-card,.f49-my-row-group,.analytics-card,.analytics-block,.analytics-table-wrap,.fr-reference,.fr-panel,.fr-zodiac-card,.ball-number,.fr-number,.badge,.label),
  body .generation-tag,body .generation-domain b,
  body.page-login #content>.login,body.page-register form[component="register/local"],body #friends-bottom-nav,
  .directory,.directory .route,.route-modal{corner-shape:squircle}
}
