/* The portal keeps its own navigation. The game opens in an expanded in-page
   stage and never requests the browser Fullscreen API. F toggles portal view. */
.cm-microbiomon-page{margin:0;background:#09141c;color:#e8f1eb;font-family:system-ui,sans-serif}.cm-games-layout{display:flex;min-height:100dvh}.cm-games-main{flex:1;min-width:0}.cm-ai-home-header{display:flex;align-items:center;gap:15px;padding:16px 24px;border-bottom:1px solid #ffffff12;background:#09131d}.cm-ai-home-brand{display:flex;flex-direction:column;gap:3px}.cm-ai-home-brand small{color:#96abbf;font-size:11px;letter-spacing:.12em;text-transform:uppercase}.cm-ai-home-brand strong{color:#8ce4dc;font-size:17px}.cm-ai-home-menu{width:42px;height:42px;border:1px solid #ffffff18;border-radius:12px;background:#ffffff0c;color:white;font-size:22px}
#cm-microbiomon{box-sizing:border-box;position:relative;min-height:320px;padding:12px;display:grid;place-items:center;isolation:isolate;background:#09141c}#cm-microbiomon *{box-sizing:border-box}#cm-microbiomon.mm-screen-fill{position:fixed;inset:0;z-index:100000;width:100%;height:100dvh;max-width:none;min-height:0;padding:0;overflow:hidden;overscroll-behavior:none;background:radial-gradient(ellipse at center,#213b42,#09141c 76%)}
#cm-microbiomon .mm-console{display:flex;justify-content:center;align-items:center;width:max-content;max-width:100%;margin:0;padding:0;line-height:0}#cm-microbiomon .mm-stage{position:relative;flex:none;max-width:100%;overflow:hidden;background:#142b31;isolation:isolate}#cm-microbiomon #mm-canvas{display:block;max-width:100%;image-rendering:auto;touch-action:none;outline:none;aspect-ratio:3/2}#cm-microbiomon .mm-ui-source[hidden]{display:none!important}.mm-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}.mm-dialog-touch{position:absolute;left:0;bottom:0;height:33%;width:100%;opacity:0;cursor:pointer;border:0;touch-action:manipulation}
/* Touch controls are inside the expanded screen, never a row beneath it. */
.mm-touch-layer{display:none;position:absolute;inset:0;z-index:3;pointer-events:none;user-select:none;-webkit-user-select:none;touch-action:none}.mm-touch-layer button{pointer-events:auto;touch-action:none;-webkit-tap-highlight-color:transparent;cursor:pointer;border:1px solid #e1f4ef66;background:#142e3d80;box-shadow:inset 0 1px 0 #ffffff25,0 2px 7px #0003;color:#f3fff6;font:600 17px/1 system-ui,sans-serif;opacity:.58;transition:opacity .12s,background .12s}.mm-touch-layer button:active,.mm-touch-layer button[aria-pressed=true]{opacity:.95;background:#407e7ac4}.mm-touch-layer button:focus-visible{outline:2px solid #e8d294;outline-offset:2px}.mm-dpad{position:absolute;left:max(14px,env(safe-area-inset-left));bottom:max(20px,env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(3,44px);grid-template-rows:repeat(2,44px);gap:3px}.mm-dpad button{border-radius:10px}.mm-dpad button:first-child{grid-column:2}.mm-dpad button:nth-child(2){grid-column:1;grid-row:2}.mm-dpad button:nth-child(3){grid-column:2;grid-row:2}.mm-dpad button:nth-child(4){grid-column:3;grid-row:2}.mm-touch-actions{position:absolute;right:max(14px,env(safe-area-inset-right));bottom:max(22px,env(safe-area-inset-bottom));display:flex;align-items:end;gap:12px}.mm-touch-actions button{width:46px;height:46px;border-radius:50%}.mm-touch-actions button:last-child{width:55px;height:55px;align-self:start;transform:translateY(-15px);font-size:22px;background:#385c638f}.mm-touch-shortcuts{position:absolute;top:max(14px,env(safe-area-inset-top));right:max(14px,env(safe-area-inset-right));display:flex;gap:7px}.mm-touch-shortcuts button{border-radius:12px;width:44px;height:44px;font-size:17px}.mm-touch-back{display:none;position:absolute;top:max(8px,env(safe-area-inset-top));right:max(8px,env(safe-area-inset-right));width:44px;height:44px;border-radius:12px}
/* Keep the controller present in every scene, including menus and questions.
   Its reserved space also keeps buttons off the canvas's interactive areas. */
/* Apply from the loading screen, including the header outside the game root. */
:is(#cm-microbiomon[data-page=play],#cm-microbiomon:has(.mm-startup,#mm-canvas),.cm-games-main:has(#cm-microbiomon[data-page=play],.mm-startup,#mm-canvas)>.cm-ai-home-header),
:is(#cm-microbiomon[data-page=play],#cm-microbiomon:has(.mm-startup,#mm-canvas),.cm-games-main:has(#cm-microbiomon[data-page=play],.mm-startup,#mm-canvas)>.cm-ai-home-header) *{
 -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;
}
.cm-games-main:has(.mm-startup,#mm-canvas) :is(.mm-startup,.mm-console,.cm-ai-home-header) :is(img,a){-webkit-user-drag:none}

#cm-microbiomon:has(#mm-canvas){touch-action:none;overscroll-behavior:none}
#cm-microbiomon :is(input,textarea,[contenteditable]:not([contenteditable=false])){user-select:text!important;-webkit-user-select:text!important;-webkit-touch-callout:default}
.mm-portrait-sheet button,.cm-games-main:has(#mm-canvas)>.cm-ai-home-header :is(a,button){touch-action:manipulation}
.mm-touch-layer button{appearance:none;-webkit-appearance:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.mm-touch-layer button[data-pressed=true]{opacity:1;background:#62d9ca;color:#082f38;border-color:#c6fff2;box-shadow:inset 0 0 0 2px #d3fff6,0 0 16px #7de8cd66;transform:translateY(1px)}
.mm-touch-actions button:last-child[data-pressed=true]{transform:translateY(-14px)}
.mm-dpad{pointer-events:auto;touch-action:none;grid-template-columns:repeat(3,48px);grid-template-rows:repeat(3,48px);gap:3px;border-radius:24px;background:#081b2460}
.mm-dpad button:first-child{grid-column:2;grid-row:1}.mm-dpad button:nth-child(2){grid-column:1;grid-row:2}.mm-dpad button:nth-child(3){grid-column:2;grid-row:3}.mm-dpad button:nth-child(4){grid-column:3;grid-row:2}
@media(pointer:coarse),(max-width:700px),(max-width:1000px) and (max-height:500px){
 .mm-touch-layer{display:block}
 #cm-microbiomon:has(#mm-canvas){padding:8px max(152px,env(safe-area-inset-right)) 8px max(168px,env(safe-area-inset-left))!important}
 .mm-dpad{left:max(10px,env(safe-area-inset-left));bottom:max(12px,env(safe-area-inset-bottom))}
 .mm-touch-actions{right:max(12px,env(safe-area-inset-right));bottom:max(24px,env(safe-area-inset-bottom));gap:10px}
 .mm-touch-actions button{width:52px;height:52px}.mm-touch-actions button:last-child{width:64px;height:64px}
 .mm-touch-shortcuts{right:max(10px,env(safe-area-inset-right));top:10px;gap:4px}.mm-touch-shortcuts button{width:42px;height:44px}
}
@media(orientation:portrait) and (pointer:coarse),(max-width:700px) and (orientation:portrait){
 #cm-microbiomon:has(#mm-canvas){padding:64px 0 calc(176px + env(safe-area-inset-bottom))!important}
 .mm-dpad{left:max(14px,env(safe-area-inset-left));bottom:calc(16px + env(safe-area-inset-bottom))}
 .mm-touch-actions{right:max(18px,env(safe-area-inset-right));bottom:calc(34px + env(safe-area-inset-bottom))}
}
@media(prefers-reduced-motion:reduce){.mm-touch-layer button{transition:none}}

.mm-portrait-sheet[hidden]{display:none!important}
@media (orientation:portrait) and (pointer:coarse),(orientation:portrait) and (max-width:700px){
 #cm-microbiomon:has(#mm-canvas){
  --mm-portrait:1;
  --pad-cell:clamp(44px,12.3vw,54px);
  display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;
  place-items:stretch;overflow:hidden;touch-action:auto;
  padding:0 env(safe-area-inset-right,0px) 0 env(safe-area-inset-left,0px)!important;
  background:#122d31;
 }
 #cm-microbiomon.mm-screen-fill:not([data-portal=true]):has(#mm-canvas){padding-top:env(safe-area-inset-top,0px)!important}
 #cm-microbiomon .mm-console{position:relative;width:100%;min-width:0;min-height:0;overflow:hidden}
 #cm-microbiomon .mm-stage{min-width:0;min-height:0}
 #cm-microbiomon:has(#mm-canvas) .mm-touch-layer{
  position:relative;inset:auto;display:grid;grid-template-columns:1fr auto;
  grid-template-rows:1fr 1fr;align-items:center;justify-items:end;gap:4px 6px;
  padding:8px clamp(8px,3vw,24px) calc(8px + env(safe-area-inset-bottom,0px));
  border-top:1px solid #81aca880;background:linear-gradient(165deg,#224848,#102935 82%);
 }
 .mm-touch-layer .mm-dpad{position:static;justify-self:start;grid-area:1/1/3/2;align-self:center;grid-template:repeat(3,var(--pad-cell))/repeat(3,var(--pad-cell));gap:2px}
 .mm-touch-layer .mm-dpad button{font-size:18px}
 .mm-touch-layer .mm-touch-shortcuts{position:static;grid-area:1/2;align-self:end;gap:3px}
 .mm-touch-layer .mm-touch-actions{position:static;grid-area:2/2;align-self:start;align-items:center;gap:10px}
 .mm-touch-layer .mm-touch-shortcuts button{width:44px;height:44px;border-radius:12px}
 .mm-touch-layer button{opacity:1;background:#2c5159;color:#edf7ee;border-color:#86aca999}
 .mm-touch-layer .mm-touch-actions button{width:50px;height:50px;font-size:20px}
 .mm-touch-layer .mm-touch-actions button:last-child{width:58px;height:58px;align-self:center;transform:none;background:#b5dfca;border-color:#dbf4d7;color:#153a37}
 .mm-touch-layer button[aria-pressed=true],.mm-touch-layer button[data-pressed=true],.mm-touch-layer .mm-touch-actions button:last-child[data-pressed=true]{background:#f1d491;color:#18393c;border-color:#ffe7b1;transform:none}
 .mm-dialog-touch{height:min(33%,22vw)}
 .mm-portrait-sheet{position:absolute;z-index:2;inset:0;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;padding:clamp(14px,4vw,28px);color:#f3f0d9;background:linear-gradient(130deg,#113532f2,#113532ba),url('art/expedition-v20/portada.webp') center/cover;font:500 16px/1.42 system-ui}
 .mm-portrait-sheet h2{margin:0 0 6px;color:#fff2cf;font:720 clamp(21px,6vw,30px)/1.12 system-ui}
 .mm-portrait-sheet small{display:block;color:#c2dfce;font:600 13px/1.4 system-ui}
 .mm-portrait-sheet p{margin:10px 0;color:#f0f0db;font:500 16px/1.45 system-ui}
 .mm-portrait-choices{display:grid;gap:6px;margin-top:12px}
 .mm-portrait-choices button{width:100%;min-height:44px;border:1px solid #8ab2a75e;border-radius:8px;padding:9px 13px;text-align:left;color:#f2f4e3;background:#163b3bf5;font:600 16px/1.3 system-ui;cursor:pointer}
 .mm-portrait-choices button[aria-current=true],.mm-portrait-choices button:focus-visible{color:#183d35;background:#f4dc9c}
 .mm-portrait-choices button:disabled{opacity:.55}
 .mm-portrait-sheet.mm-battle-choices{inset:var(--mm-arena-height) 0 0;padding:8px 12px;background:#163734}
 .mm-battle-choices .mm-portrait-choices{grid-template-columns:repeat(2,minmax(0,1fr));margin:0}
}
@media (orientation:portrait) and (pointer:coarse),(orientation:portrait) and (max-width:700px){
 .cm-games-main:has(#mm-canvas)>.cm-ai-home-header{
  display:flex!important;flex-wrap:nowrap;align-items:center;gap:6px;min-height:58px;
  padding:calc(6px + env(safe-area-inset-top,0px)) max(8px,env(safe-area-inset-right,0px)) 6px max(8px,env(safe-area-inset-left,0px));
 }
 .cm-games-main:has(#mm-canvas)>.cm-ai-home-header .cm-ai-home-brand{flex:1 1 0%;min-width:0}
 .cm-games-main:has(#mm-canvas)>.cm-ai-home-header .cm-ai-home-brand>*{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .cm-games-main:has(#mm-canvas)>.cm-ai-home-header .mm-portal-link{display:grid;place-items:center;min-width:44px;height:44px;margin-left:0}
 .cm-games-main:has(#mm-canvas)>.cm-ai-home-header :is(.cm-ai-home-menu,.mm-rate-toggle){flex:none;min-width:44px;min-height:44px}
}
