/* Shared Japanese UI typography and contrast. No per-page business behavior. */
html[data-lang="ja_jp"] body {
  --body-font-family: "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  --ja-ui-text: #1f2937;
  --ja-ui-muted: #475569;
  --ja-ui-accent: #384db3;
  --ja-ui-surface: #f3f5f7;
  --ja-ui-border: #b8c2cf;
  --ja-ui-primary: #384db3;
  --link-color: var(--ja-ui-accent);
  font-family: var(--body-font-family);
  font-size: 15px;
  font-weight: 500;
  color: var(--ja-ui-text);
}
html[data-lang="ja_jp"] body.night-mode {
  --ja-ui-text: #eef2f7;
  --ja-ui-muted: #cbd5e1;
  --ja-ui-accent: #bdcaff;
  --ja-ui-surface: #344454;
  --ja-ui-border: #64748b;
  --ja-ui-primary: #465bc2;
  --body-color-dark: #eef2f7;
  --card-dark-input-color: #eef2f7;
  color: var(--ja-ui-text);
}
html[data-lang="ja_jp"] :is(h1,h2,h3,h4,h5,h6,.card-header,.block-title) { font-weight: 600; }
html[data-lang="ja_jp"] :is(.card-header,.block-title) { font-size: 15px; line-height: 1.5; }
html[data-lang="ja_jp"] :is(.fw-light,.fw-normal,.font-weight-light,.font-weight-normal) { font-weight: 500 !important; }
html[data-lang="ja_jp"] :is(.main-side-nav,.side-nav) a,
html[data-lang="ja_jp"] :is(.main-side-nav,.side-nav) .static {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  min-height: 44px;
  color: var(--ja-ui-text);
}
html[data-lang="ja_jp"] :is(.main-side-nav,.side-nav) ul a { font-size: 14px; }
html[data-lang="ja_jp"] :is(.main-side-nav,.side-nav) li.active > a,
html[data-lang="ja_jp"] :is(.main-side-nav,.side-nav) a:hover { color: var(--ja-ui-accent); }
html[data-lang="ja_jp"] :is(.nav-link,.dropdown-item) { font-size: 15px; font-weight: 500; line-height: 1.5; }
html[data-lang="ja_jp"] .dropdown-item { white-space: normal; overflow-wrap: anywhere; }
html[data-lang="ja_jp"] .dropdown-item:not(.active):not(.disabled):not(.text-danger) { color: var(--ja-ui-text); }
html[data-lang="ja_jp"] .nav-link.active { font-weight: 600; }
html[data-lang="ja_jp"] :is(.btn,.composer-audience-choice) { font-size: 14px; font-weight: 600; }
html[data-lang="ja_jp"] .btn-primary { background-color: var(--ja-ui-primary); border-color: var(--ja-ui-primary); color: #fff; }
html[data-lang="ja_jp"] body.night-mode .btn-primary { border-color: #8799f0; }
html[data-lang="ja_jp"] :is(.btn-light,.btn-default,.btn-secondary) {
  color: var(--ja-ui-text);
  background-color: var(--ja-ui-surface);
  border-color: var(--ja-ui-border);
}
html[data-lang="ja_jp"] :is(.form-control,.form-select),
html[data-lang="ja_jp"] input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  font-family: var(--body-font-family);
  font-size: 16px;
  font-weight: 500;
}
html[data-lang="ja_jp"] :is(.form-control,.form-select) { color: var(--ja-ui-text); line-height: 1.5; }
html[data-lang="ja_jp"] :is(.form-label,label,th) { font-weight: 600; }
html[data-lang="ja_jp"] .form-label { font-size: 14px; line-height: 1.6; color: var(--ja-ui-text); }
html[data-lang="ja_jp"] :is(input,textarea)::placeholder { color: var(--ja-ui-muted); opacity: 1; font-weight: 500; }
html[data-lang="ja_jp"] :is(.form-text,.help-block,small,.small) { font-size: 13px; font-weight: 500; line-height: 1.6; }
html[data-lang="ja_jp"] :is(.form-text,.help-block,.text-muted,.post-time,.post-time a,.post-stats,.mini-footer .copyrights) { color: var(--ja-ui-muted) !important; }
html[data-lang="ja_jp"] :is(.post-time,.post-time a,.post-stats) { font-size: 13px; font-weight: 500; line-height: 1.5; }
html[data-lang="ja_jp"] .post-actions .action-btn { font-size: 14px; font-weight: 600; }
html[data-lang="ja_jp"] .posts-filter .dropdown-toggle { font-size: 14px; font-weight: 600; }
html[data-lang="ja_jp"] .mini-footer { font-size: 14px; font-weight: 500; line-height: 1.6; }
html[data-lang="ja_jp"] .mini-footer .copyrights { font-size: 13px; }
html[data-lang="ja_jp"] #publisher-box.composer-simple .ql-container { font-family: var(--body-font-family); }
html[data-lang="ja_jp"] #publisher-box.composer-simple :is(.ql-editor,textarea) { font-size: 16px; font-weight: 500; line-height: 1.65; color: var(--ja-ui-text); }
html[data-lang="ja_jp"] #publisher-box.composer-simple .ql-editor.ql-blank::before { font-weight: 500; font-style: normal; color: var(--ja-ui-muted); }
html[data-lang="ja_jp"] #publisher-box.composer-simple :is(.publisher-tools-tab,.composer-details > summary) { font-weight: 600; }
html[data-lang="ja_jp"] .footer-quick-adds .add-quick-item { font-size: 14px; font-weight: 600; color: var(--ja-ui-text); background: var(--ja-ui-surface); }
html[data-lang="ja_jp"] .footer-bottom-bar-links { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 0; }
html[data-lang="ja_jp"] .footer-bottom-bar-links > .link { min-width: 0; margin: 0; padding: 0; }
html[data-lang="ja_jp"] .footer-bottom-bar-links > .link > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 70px;
  padding: 3px 0;
  margin: 0;
  color: var(--ja-ui-text);
}
html[data-lang="ja_jp"] .footer-bottom-bar-links > .link > a > .title {
  display: block;
  width: 4em;
  max-width: 100%;
  min-height: 36px;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  color: var(--ja-ui-text);
  overflow-wrap: normal;
}
html[data-lang="ja_jp"] .footer-bottom-bar-links > .link.active > a > .title { color: var(--ja-ui-accent); }
html[data-lang="ja_jp"] .footer-bottom-bar-links > .link > a > :is(.svg-container,img) { flex: 0 0 auto; margin: 0; }
html[data-lang="ja_jp"] body.night-mode :is(.card,.modal-content,.dropdown-menu,.dropdown-widget) { color: var(--ja-ui-text); border-color: var(--ja-ui-border); }
html[data-lang="ja_jp"] body.night-mode :is(.form-control,.form-select) { color: var(--ja-ui-text); border-color: var(--ja-ui-border); }
html[data-lang="ja_jp"] body.night-mode .footer-bottom-bar { border-color: var(--ja-ui-border); }
html[data-lang="ja_jp"] body.night-mode .text-body { color: var(--ja-ui-text) !important; }
html[data-lang="ja_jp"] body.night-mode :is(.main-icon:not(.danger-icon):not(.white-icon),.main-icon:not(.danger-icon):not(.white-icon) *) {
  color: var(--ja-ui-accent) !important;
  fill: var(--ja-ui-accent) !important;
}
html[data-lang="ja_jp"] body.night-mode :is(.header-icon,.header-icon *) { color: var(--ja-ui-text) !important; fill: var(--ja-ui-text) !important; }
html[data-lang="ja_jp"] body.night-mode :is(.header-icon.active,.header-icon.active *) { color: var(--ja-ui-accent) !important; fill: var(--ja-ui-accent) !important; }
html[data-lang="ja_jp"] .alert:is(.alert-primary,.alert-secondary,.alert-success,.alert-info,.alert-warning,.alert-danger,.alert-light) { color: #142332; font-weight: 500; }
html[data-lang="ja_jp"] :is(a,button,input,select,textarea,summary):focus-visible { outline: 2px solid var(--ja-ui-accent); outline-offset: 2px; }

/* Home feed tabs and existing post bookmark controls. */
.home-feed-tabs { position:relative; scroll-margin-top:80px; display:flex; overflow-x:auto; gap:4px; border-bottom:1px solid var(--ja-ui-border,#b8c2cf); margin-bottom:16px; scrollbar-width:thin; }
.home-feed-tabs a { align-content:center; flex:0 0 auto; display:flex; align-items:center; min-height:48px; padding:10px 14px; color:var(--ja-ui-text,#1f2937); font-size:15px; font-weight:600; white-space:nowrap; text-decoration:none; border-bottom:3px solid transparent; }
.home-feed-tabs a[aria-current="page"] { color:var(--ja-ui-accent,#384db3); border-bottom-color:var(--ja-ui-accent,#384db3); background:var(--ja-ui-surface,#f3f5f7); }
.home-feed-status,.home-feed-empty { padding:20px 16px; font-size:15px; font-weight:500; color:var(--ja-ui-text,#1f2937); }
.post-actions button.action-btn { background:transparent; border:0; min-width:44px; min-height:44px; color:inherit; }
.post-actions .js_post-bookmark.js_unsave-post { color:var(--ja-ui-accent,#384db3); }
.post-actions .js_post-bookmark.js_save-post .fa-star { font-weight:400; }
.post-actions .js_post-bookmark.js_unsave-post .fa-star { font-weight:900; }
body.night-mode .post .post-media-meta .description { color:var(--ja-ui-text,#eef2f7); }
body.night-mode .post .post-actions .action-btn:hover { background:var(--ja-ui-surface,#344454); color:var(--ja-ui-text,#eef2f7); }

/* The action row already provides like/comment/repost/save controls; hide the duplicate summary row. */
html[data-lang="ja_jp"] .post-stats { display: none !important; }

/* Admin statistic card links: keep routes, improve Japanese labels and tap area. */
html[data-lang="ja_jp"] .stat-panel .stat-cell > a { display:inline-flex; align-items:center; min-height:44px; font-size:14px; font-weight:600; line-height:1.5; opacity:1; color:inherit; text-decoration:underline; }
html[data-lang="ja_jp"] .stat-panel .stat-cell > .text-lg { font-weight:600; }
/* Compact dashboard: three columns, counts and names side by side. */
.admin-dashboard-compact > .card-body { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.admin-dashboard-compact > .card-body > .row,
.admin-dashboard-compact > .card-body > .row > [class*="col-"] { display:contents; }
.admin-dashboard-compact .stat-panel { margin:0; min-width:0; }
.admin-dashboard-compact .stat-cell.narrow { display:grid; grid-template-columns:minmax(0,auto) minmax(0,1fr); align-items:center; gap:4px 7px; padding:12px; min-height:96px; }
.admin-dashboard-compact .stat-cell > .bg-icon,
.admin-dashboard-compact .stat-cell > br { display:none; }
.admin-dashboard-compact .stat-cell > .text-xxlg { font-size:26px; font-weight:700; line-height:1.2; max-width:5ch; overflow-wrap:anywhere; }
.admin-dashboard-compact .stat-cell > .text-lg { font-size:15px; font-weight:600; line-height:1.4; overflow-wrap:anywhere; }
html[data-lang="ja_jp"] .admin-dashboard-compact .stat-cell > a { grid-column:1/-1; justify-content:center; min-height:28px; margin-top:2px; font-size:13px; }
.admin-dashboard-compact #admin-chart-dashboard { grid-column:1/-1; order:1; min-width:0; margin:12px 0 0; }
@media (max-width:767.98px) {
  .admin-dashboard-compact { margin-bottom:calc(86px + env(safe-area-inset-bottom)); }
  .admin-dashboard-compact > .card-body { padding:10px; gap:8px; }
  .admin-dashboard-compact .stat-cell.narrow { padding:8px 6px; min-height:88px; column-gap:5px; }
  .admin-dashboard-compact .stat-cell > .text-xxlg { font-size:20px; max-width:4ch; }
  .admin-dashboard-compact .stat-cell > .text-lg { font-size:14px; }
}

/* Neutral surfaces keep small dashboard labels readable in both themes. */
html[data-lang="ja_jp"] .admin-dashboard-compact .stat-panel { background:var(--ja-ui-surface,#f3f5f7) !important; color:var(--ja-ui-text,#1f2937); border:1px solid var(--ja-ui-border,#b8c2cf); border-radius:10px; }
html[data-lang="ja_jp"] .admin-dashboard-compact .stat-cell > .text-xxlg { color:var(--ja-ui-accent,#384db3); }

html[data-lang="ja_jp"] .admin-dashboard-compact .stat-cell.narrow { color:var(--ja-ui-text,#1f2937) !important; }

/* Keep roughly three card rows visible on mobile without making cards tall. */
.admin-dashboard-compact #admin-chart-dashboard { order:-1; height:210px !important; margin:0 0 12px !important; }

/* Keep every home feed choice readable and preserve the feed's scroll space. */
.js_posts_stream[data-feed-scope] { min-height: 100svh; }
@media (max-width: 575.98px) {
  .home-feed-tabs { display:grid; grid-template-columns:1.1fr 1.2fr .8fr 1fr 1.2fr; gap:0; overflow:visible; }
  .home-feed-tabs a { display:flex; flex-direction:column; justify-content:center; min-width:0; min-height:48px; padding:8px 2px; font-size:14px; line-height:20px; text-align:center; white-space:nowrap; }
}
/* Story controls sit in safe-area gutters; the entire media stays visible. */
html #zuck-modal { height:100dvh; background:#000; }
html #zuck-modal-content .story-viewer .head {
  top:calc(14px + env(safe-area-inset-top, 0px)); left:calc(8px + env(safe-area-inset-left, 0px)); right:calc(8px + env(safe-area-inset-right, 0px));
  display:flex; align-items:center; justify-content:space-between; gap:8px; height:auto; min-height:48px; padding:0; line-height:1.4; color:#fff;
  text-shadow:0 1px 3px #000; z-index:100030;
}
html #zuck-modal-content .story-viewer .head .left { display:flex; align-items:center; gap:8px; flex:1; min-width:0; margin:0; }
html #zuck-modal-content .story-viewer .head .left .info { min-width:0; max-width:none; padding:4px 8px; border-radius:8px; background:rgba(0,0,0,.78); }
html #zuck-modal-content .story-viewer .head .left .info .name { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:15px; font-weight:600; line-height:21px; color:#fff; }
html #zuck-modal-content .story-viewer .head .left .time { display:block; font-size:13px; font-weight:600; line-height:18px; color:#fff; opacity:1; }
html #zuck-modal-content .story-viewer .head .item-preview { flex:0 0 32px; width:32px; height:32px; margin:0; }
html #zuck-modal-content .story-viewer.with-back-button .head .left .item-preview { margin:0; }
html #zuck-modal-content .story-viewer .head .right { display:flex; align-items:center; flex:0 0 auto; float:none; margin:0; }
html #zuck-modal-content .story-viewer .head .right .time { display:none; }
html #zuck-modal-content .story-viewer .head .left > .back,
html #zuck-modal-content .story-viewer .head .right .close {
  display:flex; align-items:center; justify-content:center; position:static; flex:0 0 44px; width:44px; height:44px; margin:0; line-height:44px; text-align:center;
  font-size:32px; color:#fff; background:rgba(0,0,0,.78); border:1px solid rgba(255,255,255,.5); border-radius:50%; text-decoration:none;
}
html #zuck-modal-content .story-viewer .slides-pointers { top:env(safe-area-inset-top, 0px); background:rgba(0,0,0,.78); }
html #zuck-modal-content .story-viewer .slides .item > .media {
  width:100%; height:100%; object-fit:contain; box-sizing:border-box;
  padding:0; z-index:1;
}
html #zuck-modal-content .story-viewer .tip {
  bottom:calc(14px + env(safe-area-inset-bottom, 0px)); box-sizing:border-box; min-height:44px; max-width:calc(100% - 32px); width:max-content; padding:10px 16px;
  font-size:14px; font-weight:600; line-height:22px; color:#fff; background:rgba(0,0,0,.82); border:1px solid rgba(255,255,255,.6); text-shadow:0 1px 3px #000; text-transform:none;
}
html #zuck-modal-content .story-viewer .slides-pagination span { width:44px; height:44px; line-height:44px; font-size:36px; color:#fff; background:rgba(0,0,0,.78); border-radius:50%; z-index:100005; }

/* Compact only the home story strip; keep full-size viewing unchanged. */
.home-stories #stories .add-story { width:92px; height:92px; }
.home-stories #stories .story { width:92px; }
.home-stories #stories .story > .item-link > .item-preview { height:92px; }
.home-stories #stories .story > .item-link > .info { font-size:14px; font-weight:500; line-height:20px; }
.home-stories #stories .story.seen { opacity:1; }
.home-stories #stories .story.seen .item-preview { opacity:.6; }
@media (max-width:575.98px) { .home-feed-tabs > a:only-child { grid-column:1 / -1; } }

/* A blurred copy fills aspect-ratio space while the foreground stays sharp. */
html #zuck-modal-content .story-viewer .slides .item::after {
  content:""; position:absolute; inset:-24px; z-index:0; background-image:var(--story-background-image); background-size:cover; background-position:center;
  filter:blur(22px) brightness(.65); pointer-events:none;
}
html #zuck-modal-content .story-viewer .head .left .info .name,
html #zuck-modal-content .story-viewer .head .left .time,
html #zuck-modal-content .story-viewer .tip { font-weight:700; }
/* Reserve the same home layout before Quill and the story strip initialize. */
#publisher-box.composer-simple .js_quill { min-height:100px; }
.home-stories #stories { min-height:120px; }
.home-stories #stories .add-story .img,
.home-stories #stories .story > .item-link > .item-preview img { border-radius:12px; }

/* Stable initial paint and in-place home feed loading. */
#publisher-box.composer-simple .js_quill:not(.ql-container)::before { content:attr(data-placeholder); display:block; padding:12px 15px; font-size:16px; font-weight:500; line-height:1.65; color:var(--ja-ui-muted,#475569); }
.home-daytime-slot { display:flow-root; min-height:95px; }
.home-feed-region { position:relative; }
.home-feed-region .home-feed-status:not(.visually-hidden) { position:absolute; top:12px; left:12px; right:12px; z-index:3; padding:12px 16px; background:var(--ja-ui-surface,#f3f5f7); border:1px solid var(--ja-ui-border,#b8c2cf); border-radius:10px; font-size:14px; font-weight:600; }
.home-feed-region[data-feed-loading] .js_posts_stream { opacity:.55; pointer-events:none; }
.home-feed-tabs.home-feed-tabs-guest { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0; overflow:visible; }
.home-feed-tabs.home-feed-tabs-guest > :is(a,button) { display:flex; flex-direction:row; justify-content:center; align-items:center; min-height:48px; padding:10px 8px; border:0; border-bottom:3px solid transparent; background:transparent; color:var(--ja-ui-text,#1f2937); font:600 15px/24px var(--body-font-family,sans-serif); white-space:nowrap; opacity:1; }
.home-feed-tabs.home-feed-tabs-guest > a[aria-current] { color:var(--ja-ui-accent,#384db3); border-bottom-color:currentColor; }
.home-store-status { margin:-4px 0 16px; font-size:13px; color:var(--ja-ui-muted,#475569); }
.story-publisher .story-media-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.story-publisher .story-media-actions .btn { min-height:44px; font-size:15px; font-weight:600; }
.story-publisher .story-media-preview .attachments { margin-top:12px; }
.story-publisher .story-media-preview .attachments:not(:has(li)) { display:none; }
.story-publisher .story-media-actions .x-uploader { position:relative; display:inline-block; margin:0; }
.modal-header:has(+ .story-publisher) .modal-title { flex:1; min-width:0; font-size:17px; font-weight:600; line-height:1.5; }
.modal-header:has(+ .story-publisher) .btn-close { flex:0 0 auto; margin-left:12px; }
html[data-lang="ja_jp"] .footer-bottom-bar-links > .link > a > .title { min-height:20px; width:auto; white-space:nowrap; }

.user-menu + .dropdown-menu .dropdown-item { font-weight:700; }
.home-stories #stories .story .name { font-weight:500; }
.post .post-actions { border-top:0; }
.post .post-stats { border-bottom:0; }
.post .post-actions .action-btn { min-height:44px; min-width:44px; display:flex; align-items:center; justify-content:center; }
.post .post-actions .reaction-btn { display:inline-flex; align-items:center; }
.post .post-actions .reaction-btn-icon { width:18px; height:18px; display:inline-flex; align-items:center; justify-content:center; }
.post .post-actions .action-icon, .post .post-actions .js_post-bookmark > i { font-size:18px; }
.post .post-actions .svg-container.action-icon, .post .post-actions .reaction-btn .emoji { width:18px !important; height:18px !important; }
.post .post-actions .svg-container.action-icon > svg { width:100%; height:100%; }
.post .post-actions :is(.post-action-reactions-count,.post-action-comments-count,.post-action-shares-count) { font-size:14px; font-weight:500; }

/* A consistent top edge for content panels, without adding space or changing height. */
body { --panel-top-edge:var(--ja-ui-border,#c5ccd5); --panel-top-shadow:rgba(15,23,42,.10); }
body.night-mode { --panel-top-edge:var(--ja-ui-border,#64748b); --panel-top-shadow:rgba(0,0,0,.35); }
.sg-offcanvas-mainbar,
.sg-offcanvas:not(:has(.sg-offcanvas-mainbar)) { box-shadow:inset 0 1px 0 var(--panel-top-edge), 0 -3px 8px var(--panel-top-shadow); }
.modal-content,
.user-menu + .dropdown-menu,
.footer-bottom-bar .dropdown-menu.dropdown-widget { border-top:1px solid var(--panel-top-edge); box-shadow:0 -3px 8px var(--panel-top-shadow); }

.story-publisher .story-media-actions .x-uploader input[type="file"] { inset:0; width:100%; height:100%; max-width:100%; min-width:0; box-sizing:border-box; }


/* Compact entity search card: the heading is unnecessary, so keep only a thin search row. */
.entity-search-card { margin-bottom:16px; }
.entity-search-card .card-body { padding:12px 16px; }
.entity-search-card .input-group { min-height:42px; }
.entity-search-card .form-control,
.entity-search-card .btn { min-height:42px; height:42px; font-size:15px; line-height:22px; }
.entity-search-card .form-control { padding:8px 12px; }
.entity-search-card .btn { padding:8px 16px; }
@media (max-width:575.98px) {
  .entity-search-card .card-body { padding:10px 12px; }
  .entity-search-card .form-control,
  .entity-search-card .btn { min-height:38px; height:38px; font-size:14px; line-height:20px; }
  .entity-search-card .form-control { padding:7px 10px; }
  .entity-search-card .btn { padding:7px 12px; }
}


/* Critical first-paint layout: keep story and suggested-reel items horizontal before plugins initialize. */
.home-stories #stories { white-space:nowrap; overflow-x:auto; overflow-y:hidden; }
.home-stories #stories > .add-story,
.home-stories #stories > .story { display:inline-block; vertical-align:top; }
.home-stories #stories > .story { margin:0 6px; }
.home-stories #stories > .story:first-of-type { margin-left:0; }
.home-stories #stories > .story:last-of-type { margin-right:0; }
.home-stories #stories > .story > .item-link { display:block; text-align:center; }
.reels-box-wrapper { display:flex; flex-wrap:nowrap; align-items:stretch; overflow:hidden; }
.reels-box-wrapper > .reel-box { flex:0 0 260px; }
