/* STEP 7 targeted UI updates — widened central content and persistent profile panel. */
/* Center the complete two-column layout, not just the main app.
   The original right margin pushed the app and profile group off center. */
@media (min-width:1250px){
 :root{--mmp-shell-total:min(calc(100vw - 36px),1540px);--mmp-profile-width:296px;--mmp-shell-gap:20px;--mmp-shell-edge:calc((100vw - var(--mmp-shell-total))/2);}
 html body .app{width:calc(var(--mmp-shell-total) - var(--mmp-profile-width) - var(--mmp-shell-gap))!important;max-width:none!important;min-width:0!important;margin-left:var(--mmp-shell-edge)!important;margin-right:0!important;}
 html body.settings-mode-community:not(.mmp-landing-active) #communityBoardWorkspace{width:calc(var(--mmp-shell-total) - var(--mmp-profile-width) - var(--mmp-shell-gap))!important;max-width:none!important;min-width:0!important;margin-left:var(--mmp-shell-edge)!important;margin-right:0!important;}
 html body .app>.topbar>.top-actions{overflow:visible!important;flex:1 1 660px!important;min-width:0!important;}
 .mmp-personal-sidebar{right:var(--mmp-shell-edge)!important;width:var(--mmp-profile-width)!important;}
 .mmp-profile-live-controls .realtime-users-popover{right:calc(var(--mmp-shell-edge) + var(--mmp-profile-width) + 12px)!important;}
}
@media (max-width:1249px){
 html body .app{width:min(100%,1100px)!important;max-width:1100px!important;margin:0 auto!important;}
 html body.settings-mode-community:not(.mmp-landing-active) #communityBoardWorkspace{width:min(100%,1100px)!important;max-width:1100px!important;margin:0 auto!important;}
}
body .app .topbar .brand .brand-meta .app-version{display:none!important;}
body .app .topbar>.top-actions>.realtime-users-slot{display:none!important;}
/* The original video mode button becomes a top-level navigation entry. */
body .app #mmpPrimaryNav :is(#videoSettingsModeBtn,#cutsceneSettingsModeBtn,#youtubeSettingsModeBtn).mmp-primary-video{display:inline-flex!important;align-items:center!important;justify-content:center!important;flex-direction:row!important;gap:7px!important;width:auto!important;min-width:0!important;height:41px!important;min-height:41px!important;padding:0 12px!important;margin:0!important;border:1px solid transparent!important;border-radius:10px!important;box-shadow:none!important;transform:none!important;background:transparent!important;color:var(--editorial-text,var(--text))!important;white-space:nowrap!important;cursor:pointer!important;}
body .app #mmpPrimaryNav :is(#videoSettingsModeBtn,#cutsceneSettingsModeBtn,#youtubeSettingsModeBtn).mmp-primary-video .settings-mode-icon{display:inline!important;width:auto!important;height:auto!important;min-width:0!important;line-height:1!important;background:none!important;border:none!important;font-size:calc(18px * var(--font-scale, 1))!important;}
body .app #mmpPrimaryNav :is(#videoSettingsModeBtn,#cutsceneSettingsModeBtn,#youtubeSettingsModeBtn).mmp-primary-video strong{font-size:calc(14px * var(--font-scale, 1))!important;font-weight:750!important;color:inherit!important;}
body .app #mmpPrimaryNav :is(#videoSettingsModeBtn,#cutsceneSettingsModeBtn,#youtubeSettingsModeBtn).mmp-primary-video:is(:hover,.mmp-active){background:var(--editorial-soft,#eeeaf7)!important;border-color:var(--editorial-line,#d5c8ec)!important;color:var(--editorial-accent,#6746ca)!important;}
body .topbar>.top-actions{min-width:0!important;overflow-x:auto!important;}
body .topbar .brand{flex-shrink:0!important;}
body .app .topbar>.top-actions button,body .app .topbar>.top-actions select{white-space:nowrap!important;text-overflow:clip!important;}
body .app .topbar .brand .brand-copy{min-width:max-content!important;}
/* Increase text size in requested home/community areas only. */
body .app .mmp-home-hero p{font-size:calc(15px * var(--font-scale, 1))!important;}
body .app .mmp-home-heading h2{font-size:calc(21px * var(--font-scale, 1))!important;}
body .app .mmp-home-post-title{font-size:calc(15px * var(--font-scale, 1))!important;line-height:1.5!important;}
body .app .mmp-home-post-meta,body .app .mmp-home-post-meta>*{font-size:calc(12px * var(--font-scale, 1))!important;}
body .app .mmp-home-eyebrow{font-size:calc(11px * var(--font-scale, 1))!important;}
body .app .mmp-home-card-subtitle,body .app .mmp-home-empty{font-size:calc(13px * var(--font-scale, 1))!important;}
body .app .mmp-home-heading button{font-size:calc(13px * var(--font-scale, 1))!important;}
body .app #mmpPrimaryNav .mmp-primary-link strong{font-size:calc(14px * var(--font-scale, 1))!important;}
body #communityBoardWorkspace .board-post-title,body #communityBoardWorkspace .board-row-title{font-size:calc(15px * var(--font-scale, 1))!important;}
body #communityBoardWorkspace .board-post-meta,body #communityBoardWorkspace .board-row-meta{font-size:calc(12px * var(--font-scale, 1))!important;}
.mmp-personal-sidebar{position:fixed;right:16px;top:126px;bottom:auto;width:286px;max-height:calc(100dvh - 142px);box-sizing:border-box;z-index:1010;display:flex;flex-direction:column;gap:11px;padding:18px;border:1px solid var(--editorial-line,#dcd7e6);border-radius:18px;background:var(--editorial-card,#fff);box-shadow:0 10px 28px rgba(31,21,58,.09);color:var(--editorial-text,#252238);overflow-y:auto;overflow-x:visible;}
.mmp-profile-heading,.mmp-profile-identity,.mmp-profile-dnd,.mmp-profile-section-title{display:flex;justify-content:space-between;align-items:center;gap:9px;}
.mmp-profile-heading h2{font-size:calc(19px * var(--font-scale, 1));margin:0;}
.mmp-profile-collapse{display:none;}
.mmp-profile-avatar{height:48px;width:48px;display:grid;place-items:center;border-radius:50%;background:var(--editorial-soft,#f1edfa);font-size:calc(24px * var(--font-scale, 1));flex-shrink:0;}
.mmp-profile-person{min-width:0;flex:1;display:flex;flex-direction:column;gap:4px;}
.mmp-profile-person strong{font-size:calc(17px * var(--font-scale, 1));overflow-wrap:anywhere;}
.mmp-profile-description,.mmp-profile-dnd-label small{font-size:calc(12px * var(--font-scale, 1));opacity:.75;}
.mmp-profile-live,.mmp-profile-dnd{border-top:1px solid var(--editorial-line,#ddd);padding-top:12px;}
.mmp-profile-live>strong,.mmp-profile-section-title strong,.mmp-profile-dnd-label strong{font-size:calc(14px * var(--font-scale, 1));}
.mmp-profile-live-controls{margin-top:8px;position:relative;min-width:0;}
.mmp-profile-live-controls .realtime-users-slot{width:100%;}
.mmp-profile-live-controls .realtime-users-button{min-width:0!important;width:100%!important;justify-content:center!important;font-size:calc(14px * var(--font-scale, 1))!important;}
.mmp-profile-live-controls .realtime-users-wrap{width:100%;}
.mmp-profile-live-controls .realtime-users-popover{position:fixed!important;right:318px!important;top:126px!important;max-height:calc(100dvh - 150px)!important;z-index:1200!important;}
.mmp-profile-action,.mmp-profile-post-item,.mmp-profile-dnd-toggle,.mmp-profile-refresh{font:inherit;border:1px solid var(--editorial-line,#ddd);border-radius:10px;background:var(--editorial-soft,#f5f1fa);color:inherit;cursor:pointer;min-height:38px;}
.mmp-profile-action{width:100%;text-align:left;padding:9px 12px;font-size:calc(14px * var(--font-scale, 1));font-weight:650;}
.mmp-profile-action:hover,.mmp-profile-post-item:hover{border-color:var(--editorial-accent,#6c4fc1);}
.mmp-profile-refresh{min-height:27px;padding:4px 8px;font-size:calc(11px * var(--font-scale, 1));}

/* Compact profile statistics; the rank tile replaces the separate chart shortcut. */
.mmp-profile-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.mmp-profile-stat{min-width:0;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;min-height:82px;padding:10px 5px;border:1px solid var(--editorial-line,#ddd);border-radius:12px;background:var(--editorial-soft,#f5f1fa);color:inherit;text-align:center;}
.mmp-profile-stat-label{font-size:calc(11px * var(--font-scale, 1));font-weight:650;line-height:1.3;white-space:nowrap;}
.mmp-profile-stat-value{font-size:calc(22px * var(--font-scale, 1));font-weight:800;line-height:1.15;overflow-wrap:anywhere;font-variant-numeric:tabular-nums;}
.mmp-profile-stat-button{font:inherit;cursor:pointer;}
.mmp-profile-stat-button:hover,.mmp-profile-stat-button:focus-visible{border-color:var(--editorial-accent,#6c4fc1);outline-offset:2px;}
/* Prevent long titles from stacking over neighboring post buttons. */
.mmp-profile-posts{display:flex;flex-direction:column;align-items:stretch;gap:7px;min-height:0;max-height:232px;overflow-y:auto;overflow-x:hidden;scrollbar-gutter:stable;padding-right:2px;}
.mmp-profile-post-item{display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;box-sizing:border-box;width:100%;height:auto!important;max-height:61px!important;min-height:0!important;flex:0 0 auto!important;text-align:left;padding:10px 11px!important;font-size:calc(13px * var(--font-scale, 1));line-height:1.45!important;white-space:normal!important;overflow:hidden!important;overflow-wrap:anywhere;word-break:break-word;text-overflow:ellipsis;}
.mmp-profile-empty{font-size:calc(12px * var(--font-scale, 1));opacity:.75;margin:0;}
.mmp-profile-dnd{margin-top:0;}
.mmp-profile-dnd-label{display:flex;flex-direction:column;gap:3px;}
.mmp-profile-dnd-toggle{min-height:36px;padding:6px 12px;font-size:calc(13px * var(--font-scale, 1));font-weight:750;}
.mmp-profile-dnd-toggle.active{background:var(--editorial-accent,#6c4fc1);color:#fff;}
.mmp-profile-dnd-toggle:disabled{opacity:.55;cursor:not-allowed;}
.mmp-profile-mobile-button{display:none;}
@media (max-width:1249px){
 .mmp-personal-sidebar{display:none;right:10px;top:64px;bottom:auto;width:min(360px,calc(100vw - 20px));max-height:calc(100dvh - 130px);z-index:1800;}
 .mmp-personal-sidebar.mmp-profile-expanded{display:flex;}
 .mmp-profile-collapse{display:inline-block;border:0;background:transparent;color:inherit;cursor:pointer;}
 .mmp-profile-mobile-button{display:block;position:fixed;z-index:1801;right:14px;bottom:14px;padding:11px 15px;border-radius:25px;border:1px solid var(--editorial-line,#ddd);background:var(--editorial-card,#fff);box-shadow:0 4px 18px #0002;color:var(--editorial-text,#252238);font-weight:750;cursor:pointer;}
 .mmp-profile-live-controls .realtime-users-popover{right:12px!important;top:115px!important;width:min(410px,calc(100vw - 24px))!important;}
}

/* Admin is visible only after the existing authenticated operator state is present. */
body .app #mmpPrimaryNav #mmpAdminPageBtn[hidden],
body .app #mmpPrimaryNav #mmpAdminLogoutBtn[hidden]{display:none!important;}

/* STEP 8: music preset and video pages use one document scrollbar.
   Their original panel content and video editor controls remain unchanged. */
html body.settings-mode-preset,
html body.settings-mode-video{overflow-y:visible!important;}

/* STEP 8: Let the main page receive wheel scrolling even when the pointer
   is above the non-scrolling center/preview area. The earlier shared rules
   use overscroll-behavior:contain, which blocks scroll chaining at the edge.
   Do not change nested editor, dialog, or profile scrolling. */
body:is(.settings-mode-direct,.settings-mode-preset) :is(#settingsPanel,#middleSettingsPanel,.center-panel),
body.settings-mode-video :is(#videoWorkspace,.video-sidebar,.video-main,.video-preview-stage){
  overscroll-behavior-y:auto!important;
}

/* The browser document is the scroller in these modes. Its canvas must use
   the same background as the selected theme, including past the page edge. */
html:has(> body:not(.light-theme)){
  background:#0e1015!important;
  color-scheme:dark;
}
html:has(> body.light-theme){
  background:#f6f7fb!important;
  color-scheme:light;
}

/* Only the online count: a high-contrast numeric badge in both themes. */
.mmp-profile-live-controls .realtime-users-button #realtimeUsersCount{
 display:inline-flex!important;align-items:center;justify-content:center;
 min-width:39px;padding:3px 8px;border-radius:8px;
 background:#087347!important;color:#ffffff!important;
 font-size:calc(15px * var(--font-scale,1))!important;
 font-weight:900!important;line-height:1.25;letter-spacing:.1px;
 font-variant-numeric:tabular-nums;
 box-shadow:inset 0 0 0 1px rgba(255,255,255,.2);
}
body:not(.light-theme) .mmp-profile-live-controls .realtime-users-button #realtimeUsersCount{
 background:#0d583b!important;color:#ffffff!important;
}

/* 2026-10-20: Shared left/center/right rail geometry. The stats card is
   positioned relative to the SAME centered group as the app and profile.
   The rail is mounted inside .app for narrow screens, never as a floating
   body child that can cover chart cards. No polling or behavior changes. */
@media (min-width:1660px){
  :root{
    --mmp-three-left:min(245px,calc(25vw - 205px));
    --mmp-three-center:min(1224px,calc(100vw - var(--mmp-three-left) - 368px));
    --mmp-three-total:calc(var(--mmp-three-left) + 12px + var(--mmp-three-center) + 20px + 296px);
    --mmp-three-edge:max(20px,calc(50vw - 898.5px));
  }
  html body .app{
    width:var(--mmp-three-center)!important;
    max-width:none!important;
    margin-left:calc(var(--mmp-three-edge) + var(--mmp-three-left) + 12px)!important;
    margin-right:0!important;
  }
  html body #mmpGenreInsights{
    position:fixed!important;
    top:126px!important;
    bottom:auto!important;
    left:var(--mmp-three-edge)!important;
    right:auto!important;
    width:var(--mmp-three-left)!important;
    max-width:none!important;
    max-height:calc(100dvh - 142px)!important;
    overflow-y:auto!important;
    margin:0!important;
    z-index:8!important;
  }
  html body .mmp-personal-sidebar{
    right:var(--mmp-three-edge)!important;
    left:auto!important;
    width:296px!important;
  }
  html body .mmp-profile-live-controls .realtime-users-popover{
    right:calc(var(--mmp-three-edge) + 296px + 12px)!important;
  }
}
@media (max-width:1659px){
  html body .app > #mmpGenreInsights{
    position:relative!important;
    inset:auto!important;
    align-self:flex-start!important;
    width:min(100%,360px)!important;
    max-width:100%!important;
    margin:12px 16px 16px!important;
    z-index:auto!important;
  }
}

/* 2026-10-20: The community board is a BODY sibling of .app, whereas
   the home area is within .app. Align only that board with the same
   three-column center geometry; leave the genre and profile rails untouched. */
@media (min-width:1660px){
  html body.settings-mode-community:not(.mmp-landing-active) #communityBoardWorkspace{
    width:var(--mmp-three-center)!important;
    max-width:none!important;
    margin-left:calc(var(--mmp-three-edge) + var(--mmp-three-left) + 12px)!important;
    margin-right:0!important;
  }
}

/* 2026-10-20: Timestamp top-menu label only. Prevent clipping at larger font
   scale or narrow layouts; allow the existing flex-wrap to move the intact
   button to another row rather than truncate the label. */
body .app #mmpPrimaryNav #youtubeSettingsModeBtn.mmp-primary-video{
  flex:0 0 auto!important;
  width:max-content!important;
  min-width:max-content!important;
  max-width:none!important;
  overflow:visible!important;
}
body .app #mmpPrimaryNav #youtubeSettingsModeBtn.mmp-primary-video .settings-mode-icon{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  flex:0 0 19px!important;
  width:19px!important;
  min-width:19px!important;
  height:19px!important;
}
body .app #mmpPrimaryNav #youtubeSettingsModeBtn.mmp-primary-video .settings-mode-copy{
  flex:0 0 auto!important;
  width:max-content!important;
  min-width:max-content!important;
  max-width:none!important;
  overflow:visible!important;
  white-space:nowrap!important;
}
body .app #mmpPrimaryNav #youtubeSettingsModeBtn.mmp-primary-video .settings-mode-copy strong{
  display:block!important;
  width:max-content!important;
  min-width:max-content!important;
  white-space:nowrap!important;
  overflow:visible!important;
  text-overflow:clip!important;
  line-height:1.35!important;
}


/* 2026-10-20: Hide only the timestamp workspace when returning to Home.
   Home navigation keeps the last tool mode on body, so the old youtube-mode
   display rule must not expose this workspace below the home content. */
body.mmp-landing-active .app > #youtubeWorkspace.youtube-workspace{
  display:none!important;
}

/* 2026-10-20: Timestamp top-menu hover should not inherit the legacy
   settings-mode-btn light-sweep overlay. Keep the shared top-nav hover style. */
body .app #mmpPrimaryNav #youtubeSettingsModeBtn.mmp-primary-video::before{
  content:none!important;
  display:none!important;
}

/* 2026-10-20: Narrow statistics drawer matching the existing profile launcher.
   The card never occupies document flow below 1900px; chart stays at the top.
   The desktop 3-column statistics card and its data logic remain unchanged. */
.mmp-genre-mobile-button,.mmp-genre-insights-close{display:none;}
@media (max-width:1899px){
 html body .app > #mmpGenreInsights{
  display:none!important;
  position:fixed!important;
  inset:auto!important;
  top:64px!important;
  left:14px!important;
  right:auto!important;
  bottom:auto!important;
  width:min(360px,calc(100vw - 28px))!important;
  max-width:calc(100vw - 28px)!important;
  max-height:calc(100dvh - 130px)!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
  margin:0!important;
  z-index:1800!important;
 }
 html body .app > #mmpGenreInsights.mmp-genre-insights-expanded{
  display:block!important;
 }
 html body .mmp-genre-mobile-button{
  display:block;
  position:fixed;
  left:14px;
  bottom:14px;
  z-index:1801;
  padding:11px 15px;
  border-radius:25px;
  border:1px solid var(--editorial-line,#ddd);
  background:var(--editorial-card,#fff);
  box-shadow:0 4px 18px #0002;
  color:var(--editorial-text,#252238);
  font-size:calc(13px * var(--font-scale,1));
  font-weight:750;
  cursor:pointer;
 }
 html body .app > #mmpGenreInsights .mmp-genre-insights-close{
  display:block;
  position:absolute;
  top:13px;
  right:12px;
  z-index:1;
  border:0;
  background:transparent;
  color:var(--editorial-text,#252238);
  font-size:calc(12px * var(--font-scale,1));
  font-weight:700;
  cursor:pointer;
 }
 html body .mmp-genre-mobile-button:focus-visible,
 html body .app > #mmpGenreInsights .mmp-genre-insights-close:focus-visible{
  outline:2px solid var(--editorial-accent,#7557cf);
  outline-offset:3px;
 }
}

/* Profile live status: title and live number in one green badge. */
.mmp-profile-live-controls .realtime-users-button .mmp-live-count-badge{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 12px;border-radius:8px;background:#087347;color:#fff;font-weight:800;line-height:1.3;white-space:nowrap;}
.mmp-profile-live-controls .realtime-users-button .mmp-live-count-badge #realtimeUsersCount{display:inline!important;min-width:0;padding:0;border-radius:0;background:transparent!important;box-shadow:none;color:inherit!important;font-size:inherit!important;font-weight:900!important;}
body:not(.light-theme) .mmp-profile-live-controls .realtime-users-button .mmp-live-count-badge{background:#0d583b;}
