
/* Hardware controllers keep their native framebuffer and input hooks. */
main{max-width:none;width:100%;padding-left:20px;padding-right:20px}header,.toolbar,.hint,.keys,.machine-access,footer{max-width:1040px;margin-left:auto;margin-right:auto}h1{text-align:left}.toolbar{justify-content:flex-start}.screen-shell,#screenbox{margin:12px auto;background:#000;border:1px solid #34414b;border-radius:5px;padding:0;display:flex;justify-content:center;align-items:center;overflow:hidden;width:fit-content;max-width:100%}canvas{display:block;image-rendering:pixelated;flex:none;outline-offset:0}#screen-fit{overflow:hidden;flex:none}#state,#status{font-size:13px;color:#b7c2ca;flex:1;min-width:180px}.hint,#mode{font-size:12px;color:#aebcc7}#mode{text-align:center;margin:8px auto}.scope{font-size:12px;color:#aebcc7;max-width:1040px;margin:7px auto}.capture{position:fixed;left:0;top:0;width:1px;height:1px;opacity:0;pointer-events:none;padding:0;border:0;font-size:16px}#mobile-input[hidden]{display:none}.secondary .back{padding:8px 0}footer{display:flex;flex-wrap:wrap;justify-content:center;align-items:center;gap:3px 8px;font-size:11px;line-height:1.35;text-align:center;padding-top:8px}footer .metrics{flex-basis:100%;color:#aebcc7}main:fullscreen{overflow:auto;background:#080a0c;padding:8px;width:100vw;height:100dvh}#screen-shell:fullscreen{padding:0;width:100vw;height:100dvh;max-width:none;background:#000}#screen-shell:fullscreen #screen-fit{margin:auto}@media(max-width:520px){main{padding:12px}.toolbar{gap:7px}.toolbar #state,.toolbar #status{flex-basis:100%}h1{font-size:23px}}

/* PC-8801 framebuffer has its own native border crop in the controller.
   Keep the public container exactly as narrow as the fitted image. */
main[data-machine="pc8801"] #screen-shell{border:0;border-radius:0;padding:0;width:max-content;max-width:100%;margin-inline:auto;justify-content:center;align-items:center}
main[data-machine="pc8801"] #canvas,main[data-machine="pc8801"] #canvas:focus-visible{outline:none;border:0}
main[data-machine="pc8801"] #screen-shell:fullscreen{width:100vw;height:100dvh;max-width:none;padding:0}
main[data-machine="pc8801"] #mobile-input{position:fixed;left:0;bottom:0;width:1px;height:1px;min-height:0;padding:0;border:0;opacity:.01;font-size:16px}

/* Keep every functional control in landscape; compact the surrounding chrome.
   Controllers retain a native physical-pixel floor and may scroll vertically. */
@media (orientation:landscape) and (max-height:500px){
 main{padding:6px 8px 8px}
 header h1{font-size:18px;line-height:20px;margin:2px auto 4px}
 .toolbar,.toolbar.secondary{gap:4px;margin:4px auto}
 .toolbar button,.toolbar select{font-size:12px;line-height:16px;padding:3px 7px;min-height:26px}
 .toolbar.secondary label{font-size:11px;gap:4px}
 .toolbar.secondary select{padding:3px 6px;min-height:26px}
 .toolbar #state,.toolbar #status{font-size:11px;min-width:100px}
 .toolbar.secondary .back{font-size:11px;line-height:16px;padding:3px 0}
 .screen-shell,#screenbox{margin:4px auto}
 #instructions,#mode,.scope{display:none}
 .keys{margin:4px auto;gap:4px}
 .keys button{min-width:38px;min-height:22px;padding:2px 6px;font-size:11px;line-height:16px}
 .machine-access{margin-top:4px;padding:3px 6px;gap:2px 8px;font-size:10px;line-height:12px}
 .machine-access strong,.machine-access a{font-size:10px;line-height:12px}
 footer{margin-top:2px;padding-top:2px;font-size:9px;line-height:12px;gap:1px 6px}
 #keyboard-panel{margin:2px auto}
 .mame-keyboard{padding:2px;margin:2px auto;max-height:160px;overflow:auto}
 .mame-keyboard-row{gap:2px;margin:2px 0;min-width:540px}
 .mame-keyboard button{min-height:20px;padding:1px 2px;font-size:10px;line-height:16px}
}

/* Override the legacy ID margin so the native full keyboard stays centered. */
main[data-machine] #keyboard-panel{width:100%;max-width:1080px;margin-inline:auto}
