/* CM0102 - true two-version switch. Scoped to avoid changing existing CM nav. */
.cm-version-switch{
  position:relative;isolation:isolate;display:inline-flex;vertical-align:middle;
  align-items:stretch;width:160px;height:33px;flex:0 0 auto;
  padding:2px;border:2px solid #07084c;border-radius:20px;
  background:#080f56;box-shadow:inset 0 1px 3px #000b,0 1px 0 #fff6;
  overflow:hidden;font-family:Arial,sans-serif;letter-spacing:0;text-shadow:none;
}
.cm-version-switch::before{
  content:"";position:absolute;z-index:0;left:2px;top:2px;
  height:calc(100% - 4px);width:calc(50% - 2px);
  border-radius:17px;background:linear-gradient(180deg,#ffeb18,#d7c200);
  box-shadow:0 1px 3px #03042abb;
  transform:translateX(0);transition:transform .17s ease-out;
}
.cm-version-switch:has([data-cm-edition="3968"][aria-pressed="true"])::before{transform:translateX(100%)}
.cm-version-switch button,
.playerbuttons .cm-version-switch button{
  position:relative!important;z-index:1;top:auto!important;right:auto!important;
  display:inline-flex;align-items:center;justify-content:center;flex:1 1 50%;min-width:0;
  height:100%;margin:0;padding:0 3px!important;border:0!important;border-radius:16px;
  background:transparent!important;color:#e2e8ff!important;
  font:700 12px/1 Arial,sans-serif!important;text-shadow:none!important;
  cursor:pointer;touch-action:manipulation;
}
.cm-version-switch button[aria-pressed="true"]{color:#071451!important;cursor:default}
.cm-version-switch button:disabled:not([aria-pressed="true"]){opacity:.42;cursor:not-allowed}
.cm-version-switch button:focus-visible{outline:2px solid #69f0ef;outline-offset:-2px}
main>header #cmHeaderEditions{position:absolute;z-index:2;left:9px;top:50%;transform:translateY(-50%);}
main>header .cm-search-heading{display:block;text-align:center;max-width:calc(100% - 230px);}
.playerbuttons{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:35px;}
.playerbuttons #squadFromPlayer{margin-left:auto;}
.playerbuttons #cmPlayerEditions{width:156px;height:31px;}
/* Do not let the empty 3.9.60 screenshot column look like a misplaced caption. */
.profilegrid .shot #noShot:not(.hide){
  display:flex;align-items:center;justify-content:center;
  min-height:clamp(180px,40vw,430px);padding:15px;
  color:#80f2ed;text-align:center;font-weight:700;font-size:clamp(13px,1.4vw,19px);
}
@media(max-width:900px),(max-width:1024px) and (pointer:coarse){
  main>header {padding:0 54px 0 124px!important;}
  main>header #cmHeaderEditions{width:116px;height:29px;left:4px;}
  main>header #cmHeaderEditions button{font-size:10.5px!important;}
  main>header .cm-search-heading{font-size:clamp(11px,2.5vw,20px);line-height:1.05;max-width:100%;text-align:center;}
  .playerbuttons #cmPlayerEditions{width:136px;height:29px;}
  .playerbuttons #cmPlayerEditions button{font-size:11px!important;}
  .profilegrid .shot #noShot:not(.hide){min-height:200px;}
}
@media(max-width:420px){
 main>header {padding:0 53px 0 116px!important;}
 main>header #cmHeaderEditions{width:108px;}
 main>header .cm-search-heading{font-size:12px;}
}
@media(prefers-reduced-motion:reduce){.cm-version-switch::before{transition:none}}

/* CM0102 v3: Search version in CM's bottom-left news location on DESKTOP only. */
@media(min-width:901px) and (pointer:fine){
 .game main>header #cmHeaderEditions{
   position:fixed!important;top:auto!important;right:auto!important;
   bottom:15px!important;left:9px!important;transform:none!important;
   width:150px;height:33px;z-index:300;
 }
 .game main>header .cm-search-heading{max-width:calc(100% - 100px);}
 .game main>header {padding-left:4px!important;}
}
@media(max-width:900px),(pointer:coarse){
 .game main>header #cmHeaderEditions{
   position:absolute!important;top:50%!important;bottom:auto!important;
   left:4px!important;transform:translateY(-50%)!important;
   z-index:500!important;pointer-events:auto!important;
 }
}
.cm-version-switch{pointer-events:auto!important;z-index:300;}
.cm-version-switch button{pointer-events:auto!important;touch-action:manipulation;}
.cm-version-switch[data-selected="3968"]::before{transform:translateX(100%);}
.cm-version-switch[data-selected="3960"]::before{transform:translateX(0);}
.playerbuttons{position:relative;z-index:2;}
.playerbuttons #cmPlayerEditions{position:relative;z-index:310;min-width:130px;}
html.cm-ui-js .cm-seo-fallback{display:none!important;}
.cm-init-error{position:relative;z-index:999;max-width:600px;margin:14px auto;padding:15px;background:#171717;color:#fff400;border:2px solid #666;font:700 16px Arial;text-align:center;}
.cm-init-error a{color:#74f5f0;}

/* The global search switch must not sit over a player/club dialogue. */
html.cm-player-route #cmHeaderEditions,
body:has(#playerModal:not(.hide)) #cmHeaderEditions,
body:has(#squadModal:not(.hide)) #cmHeaderEditions,
body:has(#nationModal:not(.hide)) #cmHeaderEditions,
body:has(#competitionModal:not(.hide)) #cmHeaderEditions{display:none!important;}

/* CM0102-V4: fixed dimensions and no role/screenshot/portrait-driven layout shift. */
@media (min-width:901px) and (pointer:fine){
 aside.sidebar #cmHeaderEditions{
   position:fixed!important;left:4px;top:525px;bottom:auto!important;
   width:calc(100px - 8px)!important;max-width:calc(100% - 8px)!important;
   height:28px!important;transform:none!important;z-index:215;
 }
 aside.sidebar #cmHeaderEditions button{font-size:10px!important;padding:0 1px!important;}
 .game main>header .cm-search-heading{max-width:100%;}
 .game main>header{padding-left:4px!important;}
}
@media (max-width:900px), (pointer:coarse){
 main>header #cmHeaderEditions{width:108px!important;height:29px!important;}
}
/* Fixed-size profile panel regardless of which release, face or screenshot is present. */
#playerModal .playerbox{
 box-sizing:border-box!important;
 width:min(1100px,calc(100vw - 32px))!important;
 height:min(790px,calc(100dvh - 36px))!important;
 display:flex!important;flex-direction:column!important;overflow:hidden!important;
}
#playerModal .playerhead{flex:0 0 64px!important;min-height:64px;}
#playerModal .ptabs{flex:0 0 auto!important;}
#playerModal .playermeta{box-sizing:border-box!important;flex:0 0 54px!important;min-height:54px!important;max-height:54px!important;align-content:center;overflow:hidden;}
#playerModal .playerbuttons{flex:0 0 37px!important;min-height:37px!important;max-height:37px!important;box-sizing:border-box!important;}
#playerModal .profilegrid{flex:1 1 0!important;min-height:0!important;overflow-y:auto!important;overflow-x:hidden;grid-template-columns:minmax(0,40%) minmax(0,60%)!important;align-items:start;gap:8px;}
#playerModal .profilegrid>div:first-child{min-width:0!important;}
#playerModal .profileattrs{grid-template-columns:repeat(3,minmax(0,1fr))!important;min-width:0;}
#playerModal .prow{min-width:0;}
#playerModal .prow>span{min-width:0;overflow:hidden;text-overflow:ellipsis;}
#playerModal .position{min-height:60px;box-sizing:border-box;display:grid;place-items:center;align-content:center;}
#playerModal .player-face-holder{height:112px!important;min-height:112px!important;max-height:112px!important;}
#playerModal .shot{aspect-ratio:4/3!important;width:100%!important;min-width:0!important;position:relative!important;overflow:hidden!important;}
#playerModal .shot img:not(.hide){display:block!important;position:absolute;inset:0;width:100%!important;height:100%!important;object-fit:contain;}
#playerModal .shot #noShot:not(.hide){position:absolute!important;inset:0!important;display:flex;align-items:center;justify-content:center;
 margin:0!important;padding:10px!important;box-sizing:border-box;min-height:0!important;height:100%!important;width:100%!important;}
#playerModal .bottom.back-next{flex:0 0 auto!important;margin-top:4px!important;}
@media(max-width:900px), (pointer:coarse){
 #playerModal{align-items:flex-start!important;padding:5px!important;overflow:hidden!important;}
 #playerModal .playerbox{width:100%!important;max-width:100%!important;height:calc(100dvh - 10px)!important;max-height:calc(100dvh - 10px)!important;}
 #playerModal .playerhead{flex-basis:43px!important;min-height:43px!important;}
 #playerModal .playermeta{flex-basis:58px!important;min-height:58px!important;max-height:58px!important;font-size:clamp(11px,3vw,13px)!important;}
 #playerModal .playerbuttons{flex-basis:37px!important;min-height:37px!important;}
 #playerModal .profilegrid{grid-template-columns:minmax(0,1fr)!important;gap:8px;}
 #playerModal .profileattrs{grid-template-columns:repeat(3,minmax(0,1fr))!important;}
 #playerModal .position{min-height:58px!important;}
 #playerModal .shot{width:100%!important;aspect-ratio:4/3!important;}
 #playerModal .shot #noShot:not(.hide){height:100%!important;}
}
