/* Medium windows/tablets retain the real desktop board and artwork, with room
   reserved for the inspector and every native action. No device model sniffing. */
@media(min-width:951px) and (max-width:1400px){
 body.desktop-play.faithful-target[data-desktop-view] #desktop-shell{grid-template-columns:minmax(0,1fr) 240px;grid-template-rows:minmax(0,1fr) 144px}
 body.desktop-play.faithful-target[data-desktop-view] .desktop-board{padding:8px 8px 6px 72px}
 body.desktop-play.faithful-target[data-desktop-view] #worlds{align-content:start;align-content:safe center;row-gap:18px;column-gap:12px}
 body.desktop-play.faithful-target[data-desktop-view] #desktop-workshop{left:6px;width:60px;padding:5px 3px;gap:4px;top:calc((100% - 144px - 240px)/2);height:240px}
 body.desktop-play.faithful-target[data-desktop-view] #desktop-workshop button{width:52px;min-height:48px;font-size:10px;padding:3px 1px}
 body.desktop-play.faithful-target[data-desktop-view] #desktop-workshop .workshop-icon{width:25px;height:25px}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #desktop-dock{grid-column:1/-1;grid-row:2;width:min(860px,calc(100% - 150px));height:144px;margin:0 auto;padding:4px 16px 8px;min-height:0}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #desktop-actions,body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar{height:100%;min-height:0}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar{transform:none;gap:8px;grid-template-columns:repeat(5,minmax(0,136px));justify-content:center}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar button{min-height:0;height:100%;gap:0}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar .painted-action{width:100%;height:100%;inset:0}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar .faithful-action-paper{box-sizing:border-box;position:absolute;top:64%;left:10%;width:80%;min-height:0;height:31%;margin:0;padding:0;gap:0;justify-content:center}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar .painted-action-label{font-size:14px;line-height:15px}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar .action-cost{font-size:12px;line-height:13px;min-height:0}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar .action-cost .sw-symbol{width:14px;height:14px}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar .action-event-note{font-size:9px;line-height:10px;min-height:0;margin:0}
 body.desktop-play.faithful-target[data-desktop-view] #desktop-inspector{grid-row:1;max-height:calc(100% - 12px);margin:6px 10px 0 0;padding:18px 14px}
 body.desktop-play.faithful-target[data-desktop-view] #selected h2{font-size:23px}
 body.desktop-play.faithful-target[data-desktop-view] #selected .worldportrait{height:94px}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] .world-meta>.mini-vehicles{display:none}
}
@media(min-width:951px) and (max-width:1400px) and (orientation:portrait){
 body.desktop-play.faithful-target[data-desktop-view] #desktop-shell{grid-template-columns:minmax(0,1fr) 220px}
 body.desktop-play.faithful-target[data-desktop-view] #desktop-top-players{max-width:none;flex:1;min-width:0}
 body.desktop-play.faithful-target[data-desktop-view] .brand{width:150px;flex-basis:150px}
 body.desktop-play.faithful-target[data-desktop-view] .brand-logo{width:150px}
 body.desktop-play.faithful-target[data-desktop-view] #players{gap:5px}
 body.desktop-play.faithful-target[data-desktop-view] #players .player{min-width:0}
}

@media(min-width:951px) and (max-width:1400px){
 body.desktop-play.faithful-target[data-desktop-view] header{padding-right:110px;gap:10px}
 body.desktop-play.faithful-target[data-desktop-view] #round{right:28px;width:76px;height:76px}
 body.desktop-play.faithful-target[data-desktop-view] #round .round-value{font-size:26px}
 body.desktop-play.faithful-target[data-desktop-view] header:before{display:none}
}

@media(min-width:951px){
 body.desktop-play.faithful-target[data-desktop-view=tabletop] .mini-colonies .mini-piece.occupied:has(.painted-piece)>.sw-symbol{display:none}
}

@media(min-width:951px) and (max-width:1400px){
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar .action-event-note .sw-symbol{width:10px;height:10px}
}

/* Smaller tablets use the common map-first UI, with tablet-sized typography. */
@media(min-width:701px) and (max-width:950px) and (orientation:portrait){
 .phone-refined #phone-faithful .board>.world{grid-template-rows:minmax(0,1fr) 28px 20px}
 .phone-refined #phone-faithful .world-name{height:28px;min-height:28px;max-width:180px;font-size:14px}
 .phone-refined #phone-faithful .world-name .sw-symbol{width:14px;height:14px}
 .phone-refined #phone-faithful .player-line{font-size:14px}
 .phone-refined #phone-faithful .player-stats{font-size:13px}
 .phone-refined #phone-faithful .production-values{font-size:12px}
 .phone-refined #phone-faithful .action-label{font-size:14px}
 .phone-refined #phone-faithful .cost{font-size:12px}
 .phone-refined #phone-faithful .mini-header .logo{width:180px;height:36px;max-width:180px}
}
@media(min-width:951px) and (max-width:1400px){
 body.desktop-play.faithful-target[data-desktop-view]{box-sizing:border-box;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
}

@media(min-width:951px){
 body.desktop-play.faithful-target #actionbar .action-label-fit .faithful-action-paper>*{flex:none}
 body.desktop-play.faithful-target #actionbar .action-label-fit .painted-action-label{font-size:13px;line-height:14px;white-space:normal;overflow-wrap:anywhere;text-align:center;max-width:100%}
 body.desktop-play.faithful-target #actionbar .action-label-fit .action-cost{font-size:12px;line-height:12px;min-height:0}
 body.desktop-play.faithful-target #actionbar .action-label-fit .action-cost .sw-symbol{width:12px;height:12px}
 body.desktop-play.faithful-target #actionbar .action-label-fit .action-event-note{font-size:9px;line-height:10px;min-height:0;white-space:normal;flex-wrap:wrap;max-width:100%;text-align:center}
 body.desktop-play.faithful-target #actionbar .action-label-fit .action-event-note .sw-symbol{width:10px;height:10px}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar button.action-label-grow,body.desktop-play.faithful-target[data-desktop-view=tabletop] #actionbar #supply.action-label-grow{min-height:var(--action-min-height,160px)}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #desktop-shell:has(.action-label-grow){grid-template-rows:minmax(0,1fr) auto}
}

/* Reserve annotation rails outside the entire terrain rectangle in both views.
   Keep counters on the board background, with a halo rather than another box. */
@media(min-width:951px){
 body.desktop-play.faithful-target[data-desktop-view] #worlds .art{--planet-note-width:clamp(32px,calc(var(--world-size)*.13),42px)}
 body.desktop-play.faithful-target[data-desktop-view] #worlds .art>:is(.planet-side-trait,.planet-side-research){box-sizing:border-box;width:var(--planet-note-width);display:grid;grid-template-rows:clamp(30px,calc(var(--world-size)*.1),32px) auto;place-items:center;align-content:start;height:auto;min-height:48px;top:6%;font-size:12px;line-height:1.25;white-space:nowrap;overflow:visible}
 body.desktop-play.faithful-target[data-desktop-view] #worlds .art>.planet-side-trait{left:calc(-1 * (var(--planet-note-width) + 6px));right:auto}
 body.desktop-play.faithful-target[data-desktop-view] #worlds .art>.planet-side-research{right:calc(-1 * (var(--planet-note-width) + 6px));left:auto}
 body.desktop-play.faithful-target[data-desktop-view=tabletop] #worlds .art>:is(.planet-side-trait,.planet-side-research){color:#38291d;text-shadow:0 0 3px #fff8e8,1px 1px 1px #fff8e8,-1px -1px 1px #fff8e8}
}

/* Legacy Cosmos header caps left five companies with phone-sized columns.
   Give the row its real remaining space; scale titles by their own card width. */
@media(min-width:951px) and (max-width:1400px){
 body.desktop-play.faithful-target[data-desktop-view] #desktop-top-players{flex:1!important;max-width:none!important;min-width:0}
 body.desktop-play.faithful-target[data-desktop-view] .brand{width:clamp(130px,15vw,180px);flex-basis:clamp(130px,15vw,180px)}
 body.desktop-play.faithful-target[data-desktop-view] .brand-logo{width:100%}
 body.desktop-play.faithful-target[data-desktop-view] #players .player{container-type:inline-size}
 body.desktop-play.faithful-target[data-desktop-view] #players .company-title{font-size:16px;font-size:clamp(14px,14cqw,19px);line-height:1.2}
}
