*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;background:#000;color:#fff;font-family:"Courier New",monospace;overflow:hidden;position:fixed;inset:0;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;touch-action:none;overscroll-behavior:none}
body{display:flex;justify-content:center;align-items:flex-start}
#game-wrapper{display:flex;flex-direction:column;align-items:center;gap:4px;padding-top:4px}
#topbar{width:var(--cw);min-width:220px;display:flex;justify-content:space-between;align-items:center;height:28px}
#back-link{color:#20ff20;text-decoration:none;font-size:12px;letter-spacing:2px;border:1px solid #20ff20;padding:4px 8px}
.mini-btn{background:#000;color:#fff;border:1px solid #fff;font:inherit;font-size:12px;padding:4px 8px;cursor:pointer}
#game{display:block;image-rendering:pixelated;image-rendering:crisp-edges;touch-action:none;background:#000}
#help{font-size:11px;color:#20ff20;text-align:center;max-width:var(--cw);letter-spacing:0.5px}
#pad,#actions{display:none}
body.touch #help{display:none}
body.touch #pad{
  display:flex;gap:12px;position:fixed;z-index:6;touch-action:none;
  left:max(12px,env(safe-area-inset-left));
  bottom:max(18px,env(safe-area-inset-bottom));
}
.dpad-btn{
  width:72px;height:72px;border-radius:14px;
  border:3px solid #20ff20;background:rgba(32,255,32,.08);
  color:#20ff20;font-size:24px;line-height:1;padding:0;
  display:flex;align-items:center;justify-content:center;touch-action:none;
}
.dpad-btn.active{background:rgba(32,255,32,.45);color:#000}
body.touch #actions{
  display:flex;flex-direction:column;align-items:flex-end;gap:12px;position:fixed;z-index:6;
  right:max(14px,env(safe-area-inset-right));
  bottom:max(18px,env(safe-area-inset-bottom));
}
.act-btn{
  border-radius:16px;font:inherit;font-weight:bold;touch-action:none;
}
.act-btn.start{width:84px;height:40px;font-size:14px;border:3px solid #fff;background:rgba(255,255,255,.1);color:#fff}
.act-btn.fire{width:96px;height:96px;border-radius:50%;font-size:18px;border:3px solid #ff3030;background:rgba(255,48,48,.14);color:#ff3030}
.act-btn.active{background:rgba(255,255,255,.5);color:#000}
.act-btn.fire.active{background:rgba(255,48,48,.55);color:#000}
@media (orientation:landscape){
  body.touch .dpad-btn{width:64px;height:64px}
  body.touch .act-btn.fire{width:84px;height:84px}
  body.touch .act-btn.start{width:76px;height:36px}
}
