* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #1e2b3a 0%, #0f141b 100%);
  color: #fff;
  overflow-x: hidden;
}
.wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
}
.hud {
  width: min(960px, 100%);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 15px;
}
.game-shell {
  position: relative;
  width: min(960px, 100%);
}
canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  background: linear-gradient(180deg, #8ec5ff 0%, #cfeaff 52%, #4a7a35 52%, #2c5522 100%);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  border-radius: 12px;
}
.hidden { display: none; }
.panel {
  background: rgba(15, 20, 27, 0.95);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px 28px;
  text-align: center;
  min-width: 280px;
  max-width: 90%;
}
.panel h1 { margin-top: 0; }
.mobile-controls {
  width: min(960px, 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  user-select: none;
}
.dpad, .actions {
  display: flex;
  gap: 10px;
}
.ctrl-btn {
  border: none;
  border-radius: 18px;
  background: rgba(255,255,255,0.14);
  color: #fff;
  min-width: 62px;
  min-height: 62px;
  padding: 0 18px;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0,0,0,0.22);
}
.ctrl-btn:active,
.ctrl-btn.active {
  transform: scale(0.96);
  background: rgba(255,255,255,0.24);
}
.ctrl-btn.jump { background: rgba(86, 172, 255, 0.6); }
.ctrl-btn.fire { background: rgba(255, 90, 90, 0.72); }
@media (min-width: 901px) {
  .mobile-controls {
    max-width: 720px;
  }
}
@media (max-width: 768px) {
  .wrap {
    justify-content: flex-start;
    padding: 10px;
    gap: 10px;
  }
  .hud {
    font-size: 13px;
    gap: 6px 10px;
  }
  .ctrl-btn {
    min-width: 58px;
    min-height: 58px;
    font-size: 22px;
  }
}
