/* The desktop home grows with its actions. Installation, game modes and the
   sponsor footer occupy separate rows instead of competing for a fixed bottom. */
@media (min-width:901px) {
  #home-screen{height:auto;min-height:calc(100svh - 84px);max-height:none;}
  #home-screen.active{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(auto,1fr) auto auto;}
  #home-screen .home-copy{grid-area:1/1;padding-top:clamp(32px,4svh,56px);padding-bottom:32px;}
  #home-screen .hero-art{grid-area:1/1/2/2;top:0;bottom:0;height:auto;}
  #home-screen .home-bottom{grid-area:2/1;position:relative;inset:auto;margin:0 5% 0 6.2%;padding-top:20px;flex-wrap:wrap;gap:20px 30px;}
  #home-screen .home-sponsor{flex:0 1 480px;min-width:0;}
  #home-screen .home-sponsor>span:last-child{min-width:0;}
  #home-screen .home-bottom .location{flex:1 1 185px;}
  #home-screen .home-bottom>.text-link{flex-shrink:0;}
  #home-screen .build-label{grid-area:3/1;position:relative;inset:auto;margin:0 5% 0 6.2%;padding:18px 0 13px;line-height:1.5;}
}
/* Keep the landscape roster in one explicit row regardless of older breakpoints. */
@media (orientation:landscape) and (max-height:600px) and (max-width:1200px) {
  #header{height:auto;min-height:88px;padding:0 max(12px,env(safe-area-inset-right)) 0 max(12px,env(safe-area-inset-left));gap:0 12px;flex-wrap:wrap;align-content:center;}
  #header .brand .nm-logo{width:86px;height:39px;}
  #header .fighters-word,#header .edition{display:none;}
  #header nav{display:flex!important;order:3;flex:0 0 100%;width:100%;min-width:0;justify-content:flex-start;gap:15px;overflow-x:auto;scrollbar-width:thin;overscroll-behavior-x:contain;}
  #header nav button{height:40px;min-height:40px;flex:none;padding:0 2px;font-size:10px;letter-spacing:.5px;white-space:nowrap;}
  #header .header-tools{margin-left:auto;gap:6px;}
  #header .icon-btn{width:38px;height:38px;min-width:38px;font-size:20px;}
  #header .player-chip{max-width:160px;min-height:40px;font-size:13px;}
  #select-screen{padding:10px max(12px,env(safe-area-inset-right)) 16px max(12px,env(safe-area-inset-left));}
  #select-screen .select-heading{margin-bottom:8px;gap:10px;}
  #select-screen .select-heading .eyebrow{display:none;}
  #select-screen .select-heading h2{font-size:30px;margin:0;}
  #select-screen .division-tabs{gap:6px;margin:7px 0 9px;flex-wrap:nowrap;overflow-x:auto;}
  #select-screen .division-tabs button{min-height:36px;padding:5px 12px;font-size:11px;white-space:nowrap;}
  #select-screen .select-layout{display:grid;grid-template-columns:minmax(94px,.7fr) minmax(0,3fr) minmax(94px,.7fr);grid-template-areas:'one roster two';gap:10px;align-items:stretch;}
  #select-screen #feature-one{grid-area:one;}
  #select-screen #feature-two{grid-area:two;}
  #select-screen .roster-center{grid-area:roster;min-width:0;}
  #select-screen .fighter-feature{height:clamp(180px,55dvh,240px);min-height:0;padding:0;overflow:hidden;}
  #select-screen .fighter-feature canvas{position:absolute;inset:18px 0 31px;width:100%;height:calc(100% - 49px);object-fit:contain;}
  #select-screen .player-tag{top:1px;left:0;font-size:8px;letter-spacing:.6px;white-space:nowrap;}
  #select-screen .team-crest{display:none;}
  #select-screen .feature-info{position:absolute;left:0;right:0;bottom:1px;padding:0;text-align:center;}
  #select-screen .feature-info h3{font-size:clamp(16px,2.4vw,23px);margin:0;line-height:1.05;overflow-wrap:anywhere;}
  #select-screen .feature-info .fighter-school,#select-screen .feature-info p,#select-screen .fighter-stats{display:none;}
  #select-screen .select-tabs{margin-bottom:6px;}
  #select-screen .select-tabs button{min-height:34px;padding:5px;font-size:10px;letter-spacing:1px;}
  #select-screen .roster-grid{grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;max-height:clamp(150px,46dvh,205px);overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-right:3px;}
  #select-screen .roster-card{height:clamp(45px,12dvh,60px);min-height:44px;aspect-ratio:auto;}
  #select-screen .roster-card canvas{height:100%;width:100%;}
  #select-screen .roster-card>span{font-size:9px;bottom:2px;}
  #select-screen .roster-card .pick-mark{font-size:9px;padding:2px 4px;}
  #select-screen .roster-hint{display:none;}
  #select-screen .match-setup{display:grid;grid-template-columns:100px minmax(0,1fr) 155px;gap:8px;margin-top:10px;padding-top:10px;}
  #select-screen .match-setup>.setup-block:first-child{grid-column:1/-1;}
  #select-screen .mode-options{display:flex;flex-wrap:wrap;gap:5px;}
  #select-screen .mode-options button{font-size:10px;padding:5px 9px;min-height:36px;}
  #select-screen .mini-label{font-size:8px;margin-bottom:4px;letter-spacing:1px;}
  #select-screen .match-setup select{min-height:38px;padding:4px 8px;font-size:12px;}
  #select-screen #start-fight{grid-column:3;grid-row:2;min-width:0;font-size:17px;padding:6px 13px;min-height:44px;align-self:end;}
  #select-screen .arena-preview{margin-top:10px;}
}
.fight-joystick{position:relative;flex:none;width:142px;height:142px;border-radius:50%;border:1px solid #c0e4ff66;background:radial-gradient(circle,#13283977 0 35%,#132839b5 36% 61%,#d6eeff25 62% 63%,#0c172bb0 64%);box-shadow:inset 0 0 24px #07152680,0 3px 12px #0004;pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;color:#e3f2fc;}
.fight-joystick .stick-knob{position:absolute;left:50%;top:50%;width:47%;height:47%;border-radius:50%;border:2px solid #c1e8ff99;background:radial-gradient(circle at 35% 25%,#8eabc5,#294a65 65%,#182e44);box-shadow:0 5px 14px #0007,inset 0 1px 5px #fff5;transform:translate(calc(-50% + var(--stick-x,0px)),calc(-50% + var(--stick-y,0px)));pointer-events:none;}
.fight-joystick.held{border-color:#c4f281aa;background-color:#8ecb3430;}
.fight-joystick span:not(.stick-knob){position:absolute;font:800 8px/1 var(--body);letter-spacing:.8px;pointer-events:none;text-shadow:0 1px 3px #000;}
.stick-up{top:8px;left:50%;transform:translateX(-50%);}.stick-down{bottom:8px;left:50%;transform:translateX(-50%);}
.fight-joystick .stick-left{left:8px;top:43%;font-size:19px!important;}.fight-joystick .stick-right{right:8px;top:43%;font-size:19px!important;}
@media (orientation:landscape) and (any-pointer:coarse), (orientation:landscape) and (max-width:1000px) and (max-height:550px){
  body.fight-mode,.immersive-active body.fight-mode{--sponsor-height:56px;}
  body.fight-mode .fight-joystick{width:clamp(108px,30dvh,142px);height:clamp(108px,30dvh,142px);}
  body.fight-mode .touch-controls{left:max(15px,env(safe-area-inset-left));right:max(15px,env(safe-area-inset-right));bottom:25px;}
  body.fight-mode .fight-campaign{gap:9px;}
  body.fight-mode .campaign-brand{display:none;}
  body.fight-mode .fight-campaign h2{font-size:clamp(12px,1.65vw,17px);line-height:1.05;}
  body.fight-mode .campaign-copy p{font-size:clamp(10px,1.25vw,12px);line-height:1.12;margin-top:3px;}
  body.fight-mode #campaign-cta{min-height:44px;max-width:18%;padding:4px 7px;font-size:10px;}
  body.fight-mode #campaign-cta::before{content:'NÚCLEOMED';font-size:8px;letter-spacing:.7px;color:#d6fff0;}
  body.fight-mode #campaign-cta{flex-direction:column;gap:2px;}
}
@media (orientation:landscape) and (max-width:650px){body.fight-mode,.immersive-active body.fight-mode{--sponsor-height:64px;}body.fight-mode .fight-campaign{gap:6px;}body.fight-mode .campaign-copy p{font-size:10px;}body.fight-mode .fight-campaign h2{font-size:12px;}}
/* Portrait has room below the arena: thumbs belong in a dedicated control pad,
   not over the fighters. Landscape keeps the overlay at the far edges. */
@media (orientation:portrait) and (max-width:760px){
  body:not(.fight-mode) #header{padding-top:max(10px,env(safe-area-inset-top));height:auto;min-height:112px;}
  body.fight-mode{overflow:hidden;background:#0b1421;}
  body.fight-mode #header{display:none;}
  body.fight-mode #fight-screen.active{position:fixed;inset:0;z-index:25;display:flex;flex-direction:column;justify-content:center;width:100%;height:100vh;height:100dvh;min-height:0;padding:max(8px,env(safe-area-inset-top)) 0 max(8px,env(safe-area-inset-bottom));overflow-y:auto;overflow-x:hidden;}
  body.fight-mode #game-frame{position:relative;flex:0 0 auto;width:100%;height:56.25vw;max-height:none;min-height:0;aspect-ratio:16/9;overflow:visible;margin:0;}
  body.fight-mode #game-frame:has(#touch-controls.visible){margin-bottom:116px;}
  body.fight-mode #fight-canvas{display:block;position:absolute;inset:0;width:100%;height:100%;}
  body.fight-mode #touch-controls{top:100%;bottom:auto;left:0;right:0;height:116px;transform:none;padding:9px max(16px,env(safe-area-inset-right)) 9px max(16px,env(safe-area-inset-left));align-items:center;border-top:1px solid #91bdd342;border-bottom:1px solid #91bdd342;background:linear-gradient(110deg,#102335,#15283e);}
  body.fight-mode .fight-joystick{width:clamp(88px,24vw,98px);height:clamp(88px,24vw,98px);}
  body.fight-mode .fight-joystick span:not(.stick-knob){font-size:6px;letter-spacing:.35px;}
  body.fight-mode .touch-attacks{display:grid;grid-template:repeat(2,44px)/repeat(2,44px);gap:5px 7px;}
  body.fight-mode .touch-attacks button{width:44px;height:44px;min-width:44px;min-height:44px;border-radius:50%;margin:0;padding:0;font:italic 750 19px/1 var(--display);border:1px solid #c1daea;background:linear-gradient(150deg,#263d50,#0c1727);color:white;}
  body.fight-mode .touch-attacks button small{font:750 7px/1 var(--body);margin-top:3px;}
  body.fight-mode .touch-attacks [data-input="light"]{grid-area:2/1;}
  body.fight-mode .touch-attacks [data-input="heavy"]{grid-area:2/2;}
  body.fight-mode .touch-attacks #touch-special{grid-area:1/1;color:#d4f77d;border-color:#c1ed58;}
  body.fight-mode .touch-attacks #touch-super{grid-area:1/2;color:#edb8ff;border-color:#d8a1ed;}
  body.fight-mode .touch-attacks button.held{color:#14222e;background:#cff56c;}
  body.fight-mode .fight-hud{top:7px;left:10px;right:10px;grid-template-columns:minmax(0,1fr) 37px minmax(0,1fr);gap:8px;}
  body.fight-mode .hud-name>span{font-size:13px;}
  body.fight-mode .hud-timer>span,body.fight-mode .hud-name small{display:none;}
  body.fight-mode .hud-timer>b{font-size:30px;line-height:1;}
  body.fight-mode .hud-timer small{font-size:7px;}
  body.fight-mode .health-track{height:10px;}
  body.fight-mode .fight-location{top:48px;left:50%;transform:translateX(-50%);text-align:center;align-items:center;}
  body.fight-mode .fight-location>span{font-size:8px;}
  body.fight-mode .fight-location>small,body.fight-mode .arena-stamp{display:none;}
  body.fight-mode .energy-hud{left:9px;right:9px;bottom:4px;}
  body.fight-mode .energy-hud>div{width:40%;}
  body.fight-mode .energy-track{height:5px;}
  body.fight-mode .energy-hud>div>span{font-size:6px;margin-bottom:2px;}
  body.fight-mode .fight-footer{flex:0 0 auto;position:static;display:flex;flex-wrap:nowrap;justify-content:space-around;gap:8px;padding:4px 12px;min-height:44px;width:100%;}
  body.fight-mode .fight-footer #touch-toggle,body.fight-mode .fight-footer #match-label,body.fight-mode .fight-footer .key-legend{display:none;}
  body.fight-mode .fight-footer button{min-height:40px;}
  body.fight-mode .fight-campaign{flex:0 0 auto;padding:12px 16px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px 12px;min-height:0;}
  body.fight-mode .campaign-brand,body.fight-mode .campaign-kicker{display:none;}
  body.fight-mode .campaign-copy{grid-column:1/-1;}
  body.fight-mode .fight-campaign h2{font:750 19px/1.12 var(--display);margin:0;}
  body.fight-mode .campaign-copy p{font:500 12px/1.3 var(--body);margin:5px 0 0;}
  body.fight-mode .campaign-note{font-size:8px;margin-top:4px;}
  body.fight-mode #campaign-cta{min-height:40px;padding:8px 12px;font-size:10px;justify-self:start;grid-column:1/-1;}
  body.fight-mode #campaign-cta::before{content:'NÚCLEOMED · ';}
  body.fight-mode .power-cue{top:60px;bottom:auto;left:10px;}
  body.fight-mode .power-cue.right{left:auto;right:10px;}
  body.fight-mode .power-cue strong{font-size:13px;}
  body.fight-mode #fight-screen.active{justify-content:safe center;}
  body.fight-mode .arena-overlay{position:fixed;inset:0;z-index:40;align-items:safe center;overflow-y:auto;padding:max(20px,env(safe-area-inset-top)) 16px max(20px,env(safe-area-inset-bottom));}
  body.fight-mode #game-frame:has(.arena-overlay:not([hidden])){z-index:40;}
  body.fight-mode .overlay-box{flex-shrink:0;width:100%;max-width:390px;gap:11px;}
  body.fight-mode .overlay-box h2{font-size:60px;}
  body.fight-mode .overlay-box .primary,body.fight-mode .overlay-box .secondary{max-width:100%;}
}
